Skip to main content
POST
/
api
/
v1
/
batch
Batch Requests
curl --request POST \
  --url https://ninjachat.ai/api/v1/batch \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "requests": [
    {
      "id": "chat-1",
      "endpoint": "/api/v1/chat",
      "body": {
        "model": "gpt-5",
        "messages": [
          {
            "role": "user",
            "content": "Summarize this article about AI safety."
          }
        ]
      }
    },
    {
      "id": "image-1",
      "endpoint": "/api/v1/images",
      "body": {
        "model": "flux-2-klein",
        "prompt": "A futuristic city skyline at sunset, concept art"
      }
    }
  ]
}
'
{
  "responses": [
    {
      "id": "<string>",
      "status": 200,
      "body": {}
    }
  ],
  "cost": {
    "this_request": "$0.006"
  }
}

Authorizations

Authorization
string
header
required

API key starting with nj_sk_

Body

application/json
requests
object[]
required

List of requests to execute in batch.

Required array length: 1 - 50 elements

Response

Batch responses, one per input request.

responses
object[]
cost
object