Proxy OpenAI-compatible chat completion
Credit-gated chat completion endpoint. The gateway estimates and reserves credits, routes the desktop model id to OpenAI or OpenRouter, forwards the request, streams or buffers the upstream response, then settles actual token usage.
Request
- Base URL: / (relative, and the document was published on a file host, not at the API’s origin)
- URL: /v1/llm/chat/completions
- Auth: HTTP bearer
Headers
Required stable key for metered POST retries. Reusing the same key for the same user, route, and method reuses the same credit reservation anchor.
Optional feature/use-case label recorded in LLMUsage for cost allocation.
Optional sub-use-case label recorded in LLMUsage.
Optional agent name recorded in LLMUsage.
Request body
Example request
{
"max_tokens": 1024,
"messages": [
{
"name": "analyst",
"role": "user"
}
],
"model": "openai/gpt-4.1-mini",
"stream": true,
"temperature": 0.2,
"tool_choice": "auto"
}Response
OpenAI-compatible JSON response, or text/event-stream when stream=true.
OpenAI-compatible upstream response. For streaming calls, the same endpoint returns text/event-stream chunks.
Changes
No recorded changes to this operation across all 50 revisions of this API.