> For the complete documentation index, see [llms.txt](https://lanbridge.gitbook.io/lanbridge-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lanbridge.gitbook.io/lanbridge-docs/api.md).

# API

Chat Completions reference.

**Auth**

text

```
Authorization: Bearer <LANBRIDGE_API_KEY>
```

Missing key:

JSON

```
{"error":{"message":"Missing API key","type":"authentication_error"}}
```

**Core body fields** (OpenRouter-compatible)

| Field                                                                         | Type            | Notes                                                      |
| ----------------------------------------------------------------------------- | --------------- | ---------------------------------------------------------- |
| model                                                                         | string          | Slug, e.g. openai/gpt-5.6-sol                              |
| messages                                                                      | Message\[]      | system / developer / user / assistant / tool               |
| stream                                                                        | boolean         | SSE when true                                              |
| temperature, top\_p, top\_k, max\_tokens, max\_completion\_tokens, stop, seed | —               | Standard sampling                                          |
| tools, tool\_choice, parallel\_tool\_calls                                    | —               | OpenAI function calling; remapped for non-OpenAI providers |
| response\_format                                                              | object          | json\_object or json\_schema                               |
| models                                                                        | string\[]       | Ordered fallbacks                                          |
| provider                                                                      | object          | allow\_fallbacks, order, ignore, require\_parameters       |
| plugins                                                                       | object\[]       | Optional OpenRouter-style plugins                          |
| reasoning / reasoning\_effort                                                 | object / string | Reasoning models                                           |
| user, session\_id, metadata                                                   | —               | Abuse isolation and traces                                 |

**Fallbacks + tools example**

JSON

```
{
  "model": "anthropic/claude-opus-5",
  "models": ["openai/gpt-5.6-sol", "google/gemini-2.5-pro"],
  "messages": [{"role": "user", "content": "What is the weather in Chengdu?"}],
  "tools": [{
    "type": "function",
    "function": {
      "name": "get_weather",
      "parameters": {
        "type": "object",
        "properties": {"city": {"type": "string"}},
        "required": ["city"]
      }
    }
  }],
  "tool_choice": "auto",
  "provider": {"allow_fallbacks": true}
}
```

**Response** is object: "chat.completion" with choices\[].message (or delta when streaming) and usage. Stream ends with data: \[DONE].

**Optional headers:** HTTP-Referer, X-Title / X-OpenRouter-Title (accepted so existing OpenRouter clients need no code change).

**Errors:** 400 invalid request · 401 auth · 402 quota · 404 unknown model · 429 rate limit · 502/503 upstream. Retry 429/502 and send models for failover.
