Converge AI Gateway
Converge AI Gateway · Chat

Create a message (Anthropic format)

POST

Generates the next assistant message in the Anthropic Messages format. Clients built on the Anthropic SDKs can use the gateway with the base URL changed. The key is accepted in Authorization: Bearer or in x-api-key.

Request

Request line
POST https://models.convergestudios.ai/v1/messages
Authentication

A Converge AI Gateway virtual key, sent as Authorization: Bearer <virtual key>. The key is issued per team and is valid only for the model routes of the gateway. The same virtual key in the x-api-key header. Accepted on POST /v1/messages, as the Anthropic SDKs send it.

Request body

JSON, with Content-Type: application/json. A dash in the Required column means that requiredness is not stated.

FieldTypeRequiredDescription
modelstring—Model id from `GET /v1/models`.
max_tokensinteger—Maximum number of output tokens.
messagesarray—The conversation, as `role` and `content` pairs.

Request headers

HeaderDescriptionExample
anthropic-versionAnthropic API version, as the Anthropic SDKs send it.2023-06-01

Examples

Message, key in AuthorizationShow
Request (curl)
curl -sS -X POST https://models.convergestudios.ai/v1/messages \
  -H "Authorization: Bearer $GATEWAY_API_KEY" \
  -H 'anthropic-version: 2023-06-01' \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gemini/gemini-3.1-flash-lite",
  "max_tokens": 16,
  "messages": [
    {
      "role": "user",
      "content": "Reply with the single word: pong"
    }
  ]
}'
Response — 200
{
  "id": "example-16",
  "type": "message",
  "role": "assistant",
  "model": "gemini/gemini-3.1-flash-lite",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 8,
    "output_tokens": 1
  },
  "content": [
    {
      "type": "text",
      "text": "pong"
    }
  ],
  "stop_reason": "end_turn",
  "stop_details": null
}
Message, key in x-api-keyShow
Request (curl)
curl -sS -X POST https://models.convergestudios.ai/v1/messages \
  -H "x-api-key: $GATEWAY_API_KEY" \
  -H 'anthropic-version: 2023-06-01' \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gemini/gemini-3.1-flash-lite",
  "max_tokens": 16,
  "messages": [
    {
      "role": "user",
      "content": "Reply with the single word: pong"
    }
  ]
}'
Response — 200
{
  "id": "example-16",
  "type": "message",
  "role": "assistant",
  "model": "gemini/gemini-3.1-flash-lite",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 8,
    "output_tokens": 1
  },
  "content": [
    {
      "type": "text",
      "text": "pong"
    }
  ],
  "stop_reason": "end_turn",
  "stop_details": null
}

Response

200. A message object with the text in content[0].text, the reason that generation stopped in stop_reason, and token counts in usage.

FieldTypeDescription
idstring—
typestring—
rolestring—
modelstring—
stop_sequencenull—
usageobject—
usage.input_tokensinteger—
usage.output_tokensinteger—
content[]array—
content[].typestring—
content[].textstring—
stop_reasonstring—
stop_detailsnull—

Response headers

HeaderDescriptionExample
x-litellm-call-idIdentifier of this call on the gateway. Quote it in a support request.—
x-litellm-model-groupThe model id that served the call, as sent in model.gemini/gemini-3.1-flash-lite
x-litellm-response-costSpend of this call, as a decimal number in the unit of the team budget. Some responses do not carry this header, for example streamed responses.—
x-litellm-key-spendApproximate spend of the key, as a decimal number in the unit of the team budget. The value is the spend cached on the gateway replica that served the call, plus the spend of this call. The cached part lags behind the real total and can differ between replicas. Do not use it as an exact balance.—
x-ratelimit-limit-requestsRequest limit per minute of the deployment that served the call.15
x-ratelimit-remaining-requestsRequests that remain in the current minute on the deployment that served the call.6
x-ratelimit-limit-tokensToken limit per minute of the deployment that served the call.250000
x-ratelimit-remaining-tokensTokens that remain in the current minute on the deployment that served the call.248612