---
title: "Create an OpenRouter chat completion"
method: POST
path: "/api/openrouter/v1/chat/completions"
tags: ["OpenRouter Gateway"]
---

# Create an OpenRouter chat completion

`POST /api/openrouter/v1/chat/completions`

## Request

- Base URL: `https://api.respan.ai`
- URL: `https://api.respan.ai/api/openrouter/v1/chat/completions`
- Auth: HTTP bearer

Forward OpenRouter requests and return its response, status code, or event stream unchanged. OpenRouter fields such as `provider` and `reasoning` are preserved. Supply your Respan key in `Authorization` and your OpenRouter key in `x-openrouter-api-key`; this endpoint requires your own OpenRouter key and does not use Respan gateway credits.

## Headers

- `x-openrouter-api-key` string, required

## Request body

- object
  - `model` string, required: OpenRouter model slug, for example openai/gpt-6-luna. An openrouter/ prefix is also accepted and is stripped before the call goes upstream.
  - `messages` object[], required
  - `stream` boolean
  - `provider` object: OpenRouter provider routing block, forwarded unchanged.
  - `reasoning` object: OpenRouter reasoning block, forwarded unchanged.
  - `respan_params` object: Respan gateway metadata. Stripped before the payload reaches OpenRouter. Must be a JSON object: a string, list, number or boolean is ignored and none of its params apply.

## Response `200`

OpenRouter response or event stream.

- object

## Other responses

- `400`: `x-openrouter-api-key` is missing, or OpenRouter rejected the request. OpenRouter's own errors come back with its body.
- `402`: Relayed from OpenRouter: insufficient credits.
- `403`: The API key is missing, invalid or expired.
- `404`: Relayed from OpenRouter: unknown model or route.
- `429`: Rate limit exceeded, from Respan or relayed from OpenRouter.

## Changes

- **2026-10-21** `c30bcb383ee8`: 2 breaking, 4 info
  - request body became required
  - the `messages` request property's minItems was increased to `1`
  - api operation id `openRouterGateway_openrouter_native_chat_completions` removed and replaced with `openrouter_native_chat_completions`
  - api tag `OpenRouter Gateway` added
  - …2 more
- **2026-10-02** `b830b79cfd52`: 2 info
  - added the non-success response with the status `403`
  - removed the non-success response with the status `401`
- **2026-09-17** `6fa8242da8c2`: 1 warning, 1 info
  - deleted the `header` request parameter `Authorization`
  - the endpoint scheme security `RespanApiKey` was added to the API
- **2026-09-12** `22b868ef3f22`: 1 info
  - api operation id `openrouter-native-chat-completions` removed and replaced with `openRouterGateway_openrouter_native_chat_completions`

[Operation history](https://skmtc.dev/respan/apis/respan-api/changes/api/openrouter/v1/chat/completions/post.md)

---

[API](https://skmtc.dev/respan/apis/respan-api.md) - [All operations](https://skmtc.dev/respan/apis/respan-api/llms.txt) - [OpenAPI document](https://skmtc.dev/respan/apis/respan-api/revisions/900841387635?raw)
