# Blitz

POST /blitz - run up to 50 prompts through the key's routing in one request.

*ProxyLLM docs · https://proxyllm.ai/docs/api/blitz*

```
POST /blitz
```

Auth: **[routing key](/docs/api/authentication)** (`pllm_…`). Note the path: blitz lives at `/blitz` on the base URL itself. There is no `/v1/blitz`.

Blitz runs a batch of prompts through the routing key's lanes, under the same routing and budget rules as [chat completions](/docs/api/chat-completions), and returns every result in one response. Built for bulk jobs like classification runs and evals. The gateway runs up to 8 prompts at a time and everything must finish within 5 minutes.

## Request

```bash
curl https://api.proxyllm.ai/blitz \
  -H "Authorization: Bearer pllm_your_routing_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flagship",
    "max_cost_usd": 2,
    "prompts": [
      { "messages": [{ "role": "user", "content": "Summarize: ..." }] },
      { "messages": [{ "role": "user", "content": "Classify: ..." }], "temperature": 0 }
    ]
  }'
```

| Field          | Type            | Notes                                                                                                             |
| -------------- | --------------- | ----------------------------------------------------------------------------------------------------------------- |
| `prompts`      | array, required | 1 to 50 prompts. Each is `{ messages, model?, temperature?, max_tokens? }`.                                       |
| `model`        | string          | Default model for prompts that don't set their own. Same handling as chat completions.                            |
| `temperature`  | number          | Default for prompts that don't set their own.                                                                     |
| `max_tokens`   | number          | Default for prompts that don't set their own.                                                                     |
| `max_cost_usd` | number          | Spend cap for the whole batch. Checked before each prompt starts, so in-flight prompts can overshoot it slightly. |

## Response

HTTP status is `200` even when individual prompts fail; check per-prompt `status` in `results`. `results` is ordered by prompt index.

```json
{
  "job_id": "e7a2c410-...",
  "status": "partial",
  "total_latency_ms": 8412,
  "total_cost_usd": 0.0231,
  "success_count": 1,
  "error_count": 1,
  "results": [
    {
      "index": 0,
      "status": "success",
      "content": "Here's the summary...",
      "model": "gpt-5.5",
      "provider": "codex",
      "usage": {
        "prompt_tokens": 412,
        "completion_tokens": 128,
        "total_tokens": 540,
        "cached_tokens": 0,
        "cost_usd": 0
      },
      "latency_ms": 3120,
      "prompt_id": "1f6b...",
      "is_repeat": false,
      "finish_reason": "stop",
      "classifier_category": null
    },
    {
      "index": 1,
      "status": "error",
      "error": "cost_cap_reached",
      "model": "flagship"
    }
  ]
}
```

- `status` - `completed` when every prompt succeeded, `failed` when none did, `partial` otherwise.
- `job_id` - ties the batch together; each successful prompt also appears as its own request in [usage](https://proxyllm.ai/dashboard/usage).
- `prompt_id` and `is_repeat` - the gateway tracks repeated prompts; `is_repeat` is true when the account has sent these exact messages before.
- `classifier_category` - set when the key runs in classifier mode: the category the prompt was routed under.
- Per-prompt errors carry the failing lane's message, or `cost_cap_reached` for prompts skipped after `max_cost_usd` was hit.

Error responses use the flat shape: `{ "error": "...", "code": "..." }`.

## Errors

| Status | Code              | When                                                                     |
| ------ | ----------------- | ------------------------------------------------------------------------ |
| 400    | (none)            | `prompts` missing or empty, more than 50, or a prompt has no `messages`. |
| 400    | `no_providers`    | The key has no lanes.                                                    |
| 401    | `auth_required`   | No token sent.                                                           |
| 401    | `invalid_api_key` | Unknown or revoked routing key.                                          |
| 402    | `budget_exceeded` | Monthly budget exhausted.                                                |
| 405    | (none)            | Method other than POST.                                                  |
| 500    | `server_error`    | Creating the batch job failed.                                           |
| 500    | `unhandled`       | Unexpected crash.                                                        |

Full list: [error codes](/docs/api#error-codes).
