> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aireserve.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Wire protocol

> Under every SDK sits one HTTP endpoint — the entire surface, and how the SDKs map Bedrock shapes onto it.

Under every SDK sits one HTTP endpoint. If you prefer to integrate directly — or want to
audit exactly what your traffic looks like — this is the entire surface:

```bash theme={"dark"}
POST https://api.aireserve.com/v1/chat/completions
Authorization: Bearer aireserve_api_…
Content-Type: application/json
```

The body is OpenAI chat-completions compatible; streaming responses are standard server-sent
events terminated by `data: [DONE]`, with a final usage chunk always included.
The SDKs translate between this wire format and the Bedrock Converse shapes:

| You write (Bedrock shape)                   | The SDK sends (OpenAI wire)                                    |
| ------------------------------------------- | -------------------------------------------------------------- |
| `modelId`, `inferenceConfig.maxTokens`      | `model`, `max_tokens`                                          |
| `system` blocks                             | A single leading `system` message                              |
| `toolConfig.tools[].toolSpec`               | `tools[].function` with JSON Schema parameters                 |
| `toolResult` blocks                         | `role: "tool"` messages keyed by `tool_call_id`                |
| `image` blocks (bytes or URL)               | `image_url` content parts (bytes become base64 data URLs)      |
| Stream events (`messageStart` … `metadata`) | Translated from OpenAI SSE chunks by a per-block state machine |

The full normative mapping — every field, every edge case, the SSE state machine, and the
error-code table — lives in the cross-language specification (`SPEC.md`) that all
five SDKs are tested against. The complete REST reference with request/response schemas is
available as a separate document: *AI Reserve Chat Completions API*.

## Endpoints & playground

Every public route is documented under **Endpoints** in the sidebar, generated from the
gateway's OpenAPI specification — each page includes an interactive playground that sends
real requests to `https://api.aireserve.com` with **your own API key** (paste it into the
Authorization field; [get one here](https://portal.aireserve.com/profile#api-keys)).

The spec is exported straight from the gateway service's route schemas:

```bash theme={"dark"}
bun run apps/docs/scripts/export-openapi.ts
```
