Create a chat completion (OpenAI-compatible)
OpenAI-compatible chat completion endpoint. Accepts the same body shape as OpenAI's `POST /v1/chat/completions` and returns the same response shape, either a JSON `ChatCompletion` (when `stream: false`, the default) or a `text/event-stream` of `ChatCompletionChunk` objects (when `stream: true`). The bearer token is either a Privy access token (the dashboard) or an `sk-` API key (services). Threads are persisted via a custom header — see the Inference module docs for the full list of non-OpenAI headers. When the upstream provider fails, a `stream: false` call returns 502 with the provider's message, and a streamed call ends with a chunk that carries an `error` object (`{ message }`) before `data: [DONE]`. A streamed call never ends without either a `finish_reason` or that error chunk. For a client-side tool loop, send every earlier `tool_calls` entry together with its `role: "tool"` result: an unmatched tool call is a request the upstream cannot serve.
OpenAI-compatible chat completion endpoint. Accepts the same body shape as OpenAI's POST /v1/chat/completions and returns the same response shape, either a JSON ChatCompletion (when stream: false, the default) or a text/event-stream of ChatCompletionChunk objects (when stream: true). The bearer token is either a Privy access token (the dashboard) or an sk- API key (services). Threads are persisted via a custom header — see the Inference module docs for the full list of non-OpenAI headers. When the upstream provider fails, a stream: false call returns 502 with the provider's message, and a streamed call ends with a chunk that carries an error object ({ message }) before data: [DONE]. A streamed call never ends without either a finish_reason or that error chunk. For a client-side tool loop, send every earlier tool_calls entry together with its role: "tool" result: an unmatched tool call is a request the upstream cannot serve.
Authorization
bearerAuth A bearer token. The Account routes accept a Privy access token; the MCP transport accepts an sk- API key issued by POST /account/api-keys.
In: header
Request Body
application/json
The OpenAI Chat Completions request body.
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/chat/completions" \ -H "Content-Type: application/json" \ -d '{ "model": "string", "messages": [ { "role": "system", "content": "string" } ] }'{ "id": "string", "object": "chat.completion", "created": 0, "model": "string", "choices": [ null ], "usage": null}List the supported models (OpenAI-compatible) GET
Returns the model ids the Inference module exposes, in the OpenAI `/v1/models` shape. Ids are provider-prefixed (`newapi/...`); the prefix is what routes a chat completion. Public so a CLI or scripted integration can discover the supported set without reading the source.
Read the caller's usage summary GET
Returns the per-day quota state, the per-category breakdown, the hourly buckets the chart renders, and the most recent events the events table shows. One round trip; the dashboard calls it once on page load.