---
title: "Create a message – Superbot API"
canonical_url: "https://superbot.gg/developers/gateway/createMessage"
summary: "Anthropic Messages, transcoded to the upstream the key routes to, or answered by your agent (`model: \"superbot\"`). A request that declares its own tools, the way Codex, Claude Code and Cursor do, is answered by the superbot model driving those tools: its tool calls come back in your dialect for your client to run. So is a call that caps its reply at 512 tokens or fewer, and a call that asks for structured output (a JSON object or a JSON schema), whose reply is the model’s output alone. Any other request is answered by your agent, and outside superbot’s own apps a card it draws comes back as plain markdown: a choice as a list, sources as a Sources: list. When your agent answers, its server-side memory is kept per conversation: name one with the `x-superbot-session` header, or superbot reads the id your client sends (`prompt_cache_key`, `metadata.session_id`, `metadata.conversation_id`, a Responses `conversation` or an Anthropic `metadata.user_id`), else it keys the conversation on its first message."
---

> Markdown of https://superbot.gg/developers/gateway/createMessage. Site index: /llms.txt.

# Create a message

`POST /v1/messages`

Anthropic Messages, transcoded to the upstream the key routes to, or answered by your agent (`model: "superbot"`). A request that declares its own tools, the way Codex, Claude Code and Cursor do, is answered by the superbot model driving those tools: its tool calls come back in your dialect for your client to run. So is a call that caps its reply at 512 tokens or fewer, and a call that asks for structured output (a JSON object or a JSON schema), whose reply is the model’s output alone. Any other request is answered by your agent, and outside superbot’s own apps a card it draws comes back as plain markdown: a choice as a list, sources as a Sources: list. When your agent answers, its server-side memory is kept per conversation: name one with the `x-superbot-session` header, or superbot reads the id your client sends (`prompt_cache_key`, `metadata.session_id`, `metadata.conversation_id`, a Responses `conversation` or an Anthropic `metadata.user_id`), else it keys the conversation on its first message.

- 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 | Run the agent lane on your computer (omni). One of `omni`. |
| `x-superbot-session` | string | optional | Names the server-side conversation your agent continues: letters, digits, `_` and `-`, at most 59 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. A 401 that carries `x-superbot-error-origin: vendor` is your vendor credential’s refusal, not the gateway’s. |
| 402 | `byo_url` | The key’s budget or your credits are 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. A 403 that carries `x-superbot-error-origin: vendor` is your vendor credential’s refusal, not the gateway’s. |
| 429 | [`rate_limited`](https://superbot.gg/developers#errors-rate_limited) | Over the per-key request bucket. A 429 that carries `x-superbot-error-origin: vendor` is your vendor’s rate limit, not the gateway’s. |
| 499 | — | The caller hung up; the agent turn keeps running. |
| 5XX | — | The upstream’s own status, rendered in your dialect. When a status is your own vendor credential’s answer (a BYO or custom-endpoint dial) the response carries `x-superbot-error-origin: vendor` and `error.origin: "vendor"` with `error.vendor_status`; a refusal without them is the gateway’s own. |

## 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())
```
