Create a message
Part of Gateway, 7 operations. The overview covers keys, scopes and errors.
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.
A caller key holding gateway:invoke (Authorization: Bearer sbc_… or x-api-key: sbc_…).
Header parameters
x-superbot-routestring optionalOverride the key’s route for this request. One of
byo,credits,auto.x-superbot-modestring optionalOverride the key’s mode for this request. One of
model,agent.x-superbot-enginestring optionalRun the agent lane on your computer (omni). One of
omni.x-superbot-sessionstring optionalNames the server-side conversation your agent continues: letters, digits,
_and-, at most 59 characters.
Request body
An Anthropic Messages request body.
modelstring required
Body reference: Anthropic Messages reference.
Response 200
The answer in the dialect you dialed; streamed as server-sent events when the body asks for stream: true.
Errors
| Status | Code | What to change |
|---|---|---|
| 400 | invalid_request | A parameter or body field is invalid; |
| 401 | unauthorized | Send a live caller key or session as |
| 402 | byo_url | The key’s budget or your credits are spent ( |
| 403 | insufficient_scope | The key lacks the scope in |
| 403 | model_not_allowed | Revoked · insufficient_scope · model_not_allowed · no_vendor_credential · no_custom_upstream. A 403 that carries |
| 403 | no_vendor_credential | Revoked · insufficient_scope · model_not_allowed · no_vendor_credential · no_custom_upstream. A 403 that carries |
| 403 | no_custom_upstream | Revoked · insufficient_scope · model_not_allowed · no_vendor_credential · no_custom_upstream. A 403 that carries |
| 429 | rate_limited | Over the per-key request bucket; retry after |
| 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 |
curl
curl -sS -X POST "https://superbot.gg/v1/messages" \
-H "Authorization: Bearer $SUPERBOT_API_KEY" \
-H "content-type: application/json" \
-d '{"model":"superbot"}'JavaScript
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())200 The answer in the dialect you dialed; streamed as server-sent events when the body asks for `stream: true`.
{}400 The body is not JSON or the dialect refused it.
"string"401 Missing, malformed or unknown key. A 401 that carries `x-superbot-error-origin: vendor` is your vendor credential’s refusal, not the gateway’s.
"string"402 The key’s budget or your credits are spent (`byo_url` on the body).
"string"403 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.
"string"429 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.
"string"499 The caller hung up; the agent turn keeps running.
(no body)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.
"string"No operation matches this filter.