# Gateway (/docs/api/gateway)

Every public route of ai.codai.ro, grouped the way the code groups them.

Base URL `https://ai.codai.ro`, bearer auth with a `codai_` key, JSON in and out (SSE where noted). The groups below map one-to-one onto the route files of the gateway; each page mounts the operations of its group with a live try-it panel.

| Group | What it covers |
| --- | --- |
| [Chat & Completions](./chat.mdx) | `POST /v1/chat/completions`, `/v1/messages`, `/v1/responses` — the three wire formats |
| [Embeddings & Audio](./embeddings-audio.mdx) | Embeddings, speech-to-text, text-to-speech, ephemeral realtime tokens |
| [Models](./models.mdx) | `GET /v1/models` |
| [Agents](./agents.mdx) | Synchronous and async agent runs, steps, SSE stream, cancel |
| [Tools](./tools.mdx) | Verified web search and safe page fetch |
| [Tasks](./tasks.mdx) | Outcome-billed tasks and confirmation |
| [Sessions](./sessions.mdx) | Shared-sessions protocol v2: events, controls, lease, dispatch, stream |
| [Devices](./devices.mdx) | Devices bound to the account and the dispatch inbox |
| [Hosts](./hosts.mdx) | Phone → desktop exec relay |
| [Orgs & Sharing](./orgs-sharing.mdx) | Session shares, orgs and members |
| [Account](./account.mdx) | Account card, consents, receipts, feedback, on-device model catalog |
| [Settings](./settings.mdx) | Account-level settings shared by every device, with optimistic versioning |
| [Health](./health.mdx) | Unauthenticated probes at the root |

Not in this reference, on purpose: `/internal/**` (service-to-service, secret-gated), `/metrics` (Prometheus scrape, VPC-only), `/vscode/**` and `/copilot/**` (editor config discovery documented in the [clients guide](../../gateway/clients.mdx)), `/mcp` and `/.well-known/oauth-protected-resource` (MCP-as-server plumbing) and the legacy read-only `GET /v1/sessions[/{sessionKey}]` shape that clients without an `x-codai-device` header still receive. The realtime WebSocket `wss://ai.codai.ro/v1/realtime` cannot be expressed in OpenAPI; its contract is in the [streaming guide](../../gateway/streaming.mdx).
