---
title: "Gateway – Superbot API"
canonical_url: "https://superbot.gg/developers/gateway"
last_updated: "2026-09-25"
summary: "OpenAI- and Anthropic-shaped model calls, answered in the dialect you dialed."
---

> Markdown twin of https://superbot.gg/developers/gateway (the HTML page is canonical).
> The site index for agents is /llms.txt; every content page has a twin at its path plus `.md`.

# Gateway

OpenAI- and Anthropic-shaped model calls, answered in the dialect you dialed.

Base URL: `https://superbot.gg`. Errors: [https://superbot.gg/developers#errors](https://superbot.gg/developers#errors). Spec: [https://superbot.gg/docs/openapi.json](https://superbot.gg/docs/openapi.json).

## Operations

- [Create a chat completion](https://superbot.gg/developers/gateway/createChatCompletion.md): `POST /v1/chat/completions`
- [Create a response](https://superbot.gg/developers/gateway/createResponse.md): `POST /v1/responses`
- [Create a message](https://superbot.gg/developers/gateway/createMessage.md): `POST /v1/messages`
- [Estimate input tokens](https://superbot.gg/developers/gateway/countMessageTokens.md): `POST /v1/messages/count_tokens`
- [List models](https://superbot.gg/developers/gateway/listModels.md): `GET /v1/models`

## Create a chat completion

`POST /v1/chat/completions`

OpenAI Chat Completions: passed through to your own vendor key, transcoded, or answered by your agent (`model: "superbot"`).

- Operation id: `createChatCompletion`
- Group: [Gateway](https://superbot.gg/developers/gateway.md)
- Auth: A caller key holding `gateway:invoke` (`Authorization: Bearer sbc_…` or `x-api-key: sbc_…`).
- Scopes: `gateway:invoke`
- Body reference: [OpenAI Chat Completions reference](https://platform.openai.com/docs/api-reference/chat/create)

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `x-superbot-route` | string | optional | Override the key’s route for this request. One of `byo`, `credits`, `auto`. |
| `x-superbot-mode` | string | optional | Override the key’s mode for this request. One of `model`, `agent`. |
| `x-superbot-engine` | string | optional | Pin the agent lane to the omni engine. One of `omni`. |
| `x-superbot-session` | string | optional | Thread id, 1-59 word characters. |

### Request body

`application/json`, required. An OpenAI Chat Completions request body.

- `model` (string, required)

### Response 200

The answer in the dialect you dialed; streamed as server-sent events when the body asks for `stream: true`.

`application/json`: object.

`text/event-stream`: string.

### Errors

Every refusal carries `error`, `message`, `doc_url` and `request_id`; the gateway routes answer in the dialect you dialed.

| Status | Codes | When |
| --- | --- | --- |
| 400 | [`invalid_request`](https://superbot.gg/developers#errors-invalid_request) | The body is not JSON or the dialect refused it. |
| 401 | [`unauthorized`](https://superbot.gg/developers#errors-unauthorized) | Missing, malformed or unknown key. |
| 402 | `byo_url` | The key’s budget or the wallet is spent (`byo_url` on the body). |
| 403 | [`insufficient_scope`](https://superbot.gg/developers#errors-insufficient_scope), `model_not_allowed`, `no_vendor_credential`, `no_custom_upstream` | Revoked · insufficient_scope · model_not_allowed · no_vendor_credential · no_custom_upstream. |
| 429 | [`rate_limited`](https://superbot.gg/developers#errors-rate_limited) | Over the per-key request bucket. |
| 499 | — | The caller hung up; the agent turn keeps running. |
| 5XX | — | The upstream’s own status, rendered in your dialect. |

### Examples

```sh
curl -sS -X POST "https://superbot.gg/v1/chat/completions" \
  -H "Authorization: Bearer $SUPERBOT_API_KEY" \
  -H "content-type: application/json" \
  -d '{"model":"superbot"}'
```

```js
const res = await fetch(`https://superbot.gg/v1/chat/completions`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.SUPERBOT_API_KEY}`,
    'content-type': 'application/json',
  },
  body: JSON.stringify({"model":"superbot"}),
});
console.log(res.status, await res.json());
```

```python
import os
import requests

res = requests.request(
    "POST",
    "https://superbot.gg/v1/chat/completions",
    headers={
        "Authorization": f"Bearer {os.environ['SUPERBOT_API_KEY']}",
        "content-type": "application/json",
    },
    json={"model":"superbot"},
)
print(res.status_code, res.json())
```

## Create a response

`POST /v1/responses`

OpenAI Responses: `model: "superbot"` (or `superbot-omni`) runs your agent; a linked Codex login passes through.

- Operation id: `createResponse`
- Group: [Gateway](https://superbot.gg/developers/gateway.md)
- Auth: A caller key holding `gateway:invoke` (`Authorization: Bearer sbc_…` or `x-api-key: sbc_…`).
- Scopes: `gateway:invoke`
- Body reference: [OpenAI Responses reference](https://platform.openai.com/docs/api-reference/responses/create)

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `x-superbot-route` | string | optional | Override the key’s route for this request. One of `byo`, `credits`, `auto`. |
| `x-superbot-mode` | string | optional | Override the key’s mode for this request. One of `model`, `agent`. |
| `x-superbot-engine` | string | optional | Pin the agent lane to the omni engine. One of `omni`. |
| `x-superbot-session` | string | optional | Thread id, 1-59 word characters. |

### Request body

`application/json`, required. An OpenAI Responses request body.

- `model` (string, required)

### Response 200

The answer in the dialect you dialed; streamed as server-sent events when the body asks for `stream: true`.

`application/json`: object.

`text/event-stream`: string.

### Errors

Every refusal carries `error`, `message`, `doc_url` and `request_id`; the gateway routes answer in the dialect you dialed.

| Status | Codes | When |
| --- | --- | --- |
| 400 | [`invalid_request`](https://superbot.gg/developers#errors-invalid_request) | The body is not JSON or the dialect refused it. |
| 401 | [`unauthorized`](https://superbot.gg/developers#errors-unauthorized) | Missing, malformed or unknown key. |
| 402 | `byo_url` | The key’s budget or the wallet is spent (`byo_url` on the body). |
| 403 | [`insufficient_scope`](https://superbot.gg/developers#errors-insufficient_scope), `model_not_allowed`, `no_vendor_credential`, `no_custom_upstream` | Revoked · insufficient_scope · model_not_allowed · no_vendor_credential · no_custom_upstream. |
| 429 | [`rate_limited`](https://superbot.gg/developers#errors-rate_limited) | Over the per-key request bucket. |
| 499 | — | The caller hung up; the agent turn keeps running. |
| 5XX | — | The upstream’s own status, rendered in your dialect. |

### Examples

```sh
curl -sS -X POST "https://superbot.gg/v1/responses" \
  -H "Authorization: Bearer $SUPERBOT_API_KEY" \
  -H "content-type: application/json" \
  -d '{"model":"superbot"}'
```

```js
const res = await fetch(`https://superbot.gg/v1/responses`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.SUPERBOT_API_KEY}`,
    'content-type': 'application/json',
  },
  body: JSON.stringify({"model":"superbot"}),
});
console.log(res.status, await res.json());
```

```python
import os
import requests

res = requests.request(
    "POST",
    "https://superbot.gg/v1/responses",
    headers={
        "Authorization": f"Bearer {os.environ['SUPERBOT_API_KEY']}",
        "content-type": "application/json",
    },
    json={"model":"superbot"},
)
print(res.status_code, res.json())
```

## Create a message

`POST /v1/messages`

Anthropic Messages, transcoded to the upstream the key routes to.

- Operation id: `createMessage`
- Group: [Gateway](https://superbot.gg/developers/gateway.md)
- Auth: A caller key holding `gateway:invoke` (`Authorization: Bearer sbc_…` or `x-api-key: sbc_…`).
- Scopes: `gateway:invoke`
- Body reference: [Anthropic Messages reference](https://docs.anthropic.com/en/api/messages)

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `x-superbot-route` | string | optional | Override the key’s route for this request. One of `byo`, `credits`, `auto`. |
| `x-superbot-mode` | string | optional | Override the key’s mode for this request. One of `model`, `agent`. |
| `x-superbot-engine` | string | optional | Pin the agent lane to the omni engine. One of `omni`. |
| `x-superbot-session` | string | optional | Thread id, 1-59 word characters. |

### Request body

`application/json`, required. An Anthropic Messages request body.

- `model` (string, required)

### Response 200

The answer in the dialect you dialed; streamed as server-sent events when the body asks for `stream: true`.

`application/json`: object.

`text/event-stream`: string.

### Errors

Every refusal carries `error`, `message`, `doc_url` and `request_id`; the gateway routes answer in the dialect you dialed.

| Status | Codes | When |
| --- | --- | --- |
| 400 | [`invalid_request`](https://superbot.gg/developers#errors-invalid_request) | The body is not JSON or the dialect refused it. |
| 401 | [`unauthorized`](https://superbot.gg/developers#errors-unauthorized) | Missing, malformed or unknown key. |
| 402 | `byo_url` | The key’s budget or the wallet is spent (`byo_url` on the body). |
| 403 | [`insufficient_scope`](https://superbot.gg/developers#errors-insufficient_scope), `model_not_allowed`, `no_vendor_credential`, `no_custom_upstream` | Revoked · insufficient_scope · model_not_allowed · no_vendor_credential · no_custom_upstream. |
| 429 | [`rate_limited`](https://superbot.gg/developers#errors-rate_limited) | Over the per-key request bucket. |
| 499 | — | The caller hung up; the agent turn keeps running. |
| 5XX | — | The upstream’s own status, rendered in your dialect. |

### Examples

```sh
curl -sS -X POST "https://superbot.gg/v1/messages" \
  -H "Authorization: Bearer $SUPERBOT_API_KEY" \
  -H "content-type: application/json" \
  -d '{"model":"superbot"}'
```

```js
const res = await fetch(`https://superbot.gg/v1/messages`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.SUPERBOT_API_KEY}`,
    'content-type': 'application/json',
  },
  body: JSON.stringify({"model":"superbot"}),
});
console.log(res.status, await res.json());
```

```python
import os
import requests

res = requests.request(
    "POST",
    "https://superbot.gg/v1/messages",
    headers={
        "Authorization": f"Bearer {os.environ['SUPERBOT_API_KEY']}",
        "content-type": "application/json",
    },
    json={"model":"superbot"},
)
print(res.status_code, res.json())
```

## Estimate input tokens

`POST /v1/messages/count_tokens`

A local estimate (characters / 4). No upstream call and no charge.

- Operation id: `countMessageTokens`
- Group: [Gateway](https://superbot.gg/developers/gateway.md)
- Auth: Any live caller key (`Authorization: Bearer sbc_…` or `x-api-key: sbc_…`).
- Scopes: none
- Body reference: [Anthropic count tokens reference](https://docs.anthropic.com/en/api/messages-count-tokens)

### Request body

`application/json`, required. An Anthropic Messages body; only `messages` is read.

- `model` (string, required)

### Response 200

The estimate.

`application/json`: TokenCount.

- `input_tokens` (integer, required)

### Errors

Every refusal carries `error`, `message`, `doc_url` and `request_id`; the gateway routes answer in the dialect you dialed.

| Status | Codes | When |
| --- | --- | --- |
| 400 | [`invalid_request`](https://superbot.gg/developers#errors-invalid_request) | The body is not JSON. |
| 401 | [`unauthorized`](https://superbot.gg/developers#errors-unauthorized) | Missing, malformed or unknown key. |
| 403 | [`insufficient_scope`](https://superbot.gg/developers#errors-insufficient_scope) | The key is revoked. |

### Examples

```sh
curl -sS -X POST "https://superbot.gg/v1/messages/count_tokens" \
  -H "Authorization: Bearer $SUPERBOT_API_KEY" \
  -H "content-type: application/json" \
  -d '{"model":"superbot"}'
```

```js
const res = await fetch(`https://superbot.gg/v1/messages/count_tokens`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.SUPERBOT_API_KEY}`,
    'content-type': 'application/json',
  },
  body: JSON.stringify({"model":"superbot"}),
});
console.log(res.status, await res.json());
```

```python
import os
import requests

res = requests.request(
    "POST",
    "https://superbot.gg/v1/messages/count_tokens",
    headers={
        "Authorization": f"Bearer {os.environ['SUPERBOT_API_KEY']}",
        "content-type": "application/json",
    },
    json={"model":"superbot"},
)
print(res.status_code, res.json())
```

## List models

`GET /v1/models`

The agent models first (`superbot`, `superbot-omni`, `superbot-fast`), then your linked vendors’ models, your custom endpoints’ ids as `custom/<slug>/<id>`, then the credits catalog.

- Operation id: `listModels`
- Group: [Gateway](https://superbot.gg/developers/gateway.md)
- Auth: Any live caller key (`Authorization: Bearer sbc_…` or `x-api-key: sbc_…`).
- Scopes: none

### Response 200

Every model this key can name.

`application/json`: ModelList.

- `object` (string, required): One of `list`.
- `data` (array of Model, required)
  - `id` (string, required)
  - `object` (string, required): One of `model`.
  - `created` (integer, required)
  - `owned_by` (string, required)
  - `lane` (string)
  - `tier` (string)
  - `available` (boolean)
  - `reason` (string)
  - `min_plan` (string)
  - `auto` (boolean)
  - `context_window` (integer)
  - `context_length` (integer)

### Errors

Every refusal carries `error`, `message`, `doc_url` and `request_id`; the gateway routes answer in the dialect you dialed.

| Status | Codes | When |
| --- | --- | --- |
| 401 | [`unauthorized`](https://superbot.gg/developers#errors-unauthorized) | Missing, malformed or unknown key. |
| 403 | [`insufficient_scope`](https://superbot.gg/developers#errors-insufficient_scope) | The key is revoked. |

### Examples

```sh
curl -sS -X GET "https://superbot.gg/v1/models" \
  -H "Authorization: Bearer $SUPERBOT_API_KEY"
```

```js
const res = await fetch(`https://superbot.gg/v1/models`, {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.SUPERBOT_API_KEY}`,
  },
});
console.log(res.status, await res.json());
```

```python
import os
import requests

res = requests.request(
    "GET",
    "https://superbot.gg/v1/models",
    headers={
        "Authorization": f"Bearer {os.environ['SUPERBOT_API_KEY']}",
    },
)
print(res.status_code, res.json())
```
