Create an OpenRouter chat completion

Relay an OpenRouter chat-completions payload through Respan with nothing filtered out, so OpenRouter-owned fields such as provider and reasoning survive the call. This endpoint is BYOK: Authorization carries your Respan API key and x-openrouter-api-key carries your OpenRouter API key. There is no fallback to Respan gateway credits. OpenRouter's response, status code, and event stream are relayed back unchanged.

Authentication

AuthorizationBearer
Use your Respan API key for Respan API authentication. Enter only the Respan API key value; clients send Authorization: Bearer <RESPAN_API_KEY>. For /api/responses, provider credentials such as Perplexity, OpenAI, or Azure OpenAI go in Settings -> Providers or respan_params.credential_override in the request body, not in this authentication field.

Headers

x-openrouter-api-keystringRequired
Your OpenRouter API key. Authorization carries the Respan API key on this operation.

Request

This endpoint expects an object.
modelstringRequired

OpenRouter model slug, for example anthropic/claude-sonnet-4-5. An openrouter/ prefix is also accepted and is stripped before the call goes upstream.

messageslist of maps from strings to anyRequired
streambooleanOptionalDefaults to false
providermap from strings to anyOptional
OpenRouter provider routing block, forwarded unchanged.
reasoningmap from strings to anyOptional
OpenRouter reasoning block, forwarded unchanged.
respan_paramsmap from strings to anyOptional
Respan gateway metadata. Stripped before the payload reaches OpenRouter.

Response

OpenRouter response or event stream.

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
404
Not Found Error
429
Too Many Requests Error