aiml docs
ReferenceAPI reference

Compat anthropic

Anthropic Messages wire format; the Anthropic SDKs work unchanged

POST/v1/messages
AuthorizationBearer <token>

In: header

Header Parameters

aiml-version?string

API version (YYYY-MM-DD); defaults to the key's pinned version

Formatdate
x-aiml-debug?"1"

returns the route trace in x-aiml-route-trace

Value in

  • "1"

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Anthropic Messages request; aiml extension accepted as on the OpenAI route

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/v1/messages" \  -H "Content-Type: application/json" \  -d '{    "model": "anthropic/claude-sonnet-4.5",    "max_tokens": 1024,    "messages": [      {        "role": "user",        "content": "hi"      }    ]  }'
{  "id": "msg_01J9ZK2K4Q7Q3M3QX1V0F1GATE",  "type": "message",  "role": "assistant",  "model": "anthropic/claude-sonnet-4.5",  "content": [    {      "type": "text",      "text": "Hello! How can I help?"    }  ],  "stop_reason": "end_turn",  "usage": {    "input_tokens": 812,    "output_tokens": 143  },  "aiml": {    "request_id": "01J9ZK2K4Q7Q3M3QX1V0F1GATE",    "provider": "anthropic",    "cost": {      "total_micro_usd": 489,      "lines": [        {          "kind": "input",          "units": 812,          "unit_price_nano": 250,          "micro_usd": 203        },        {          "kind": "output",          "units": 143,          "unit_price_nano": 2000,          "micro_usd": 286        }      ],      "price_version": "pv_01J9ZK2K4Q7Q3M3QX1V0F1PV01"    }  }}
POST/v1/messages/count_tokens
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/messages/count_tokens" \  -H "Content-Type: application/json" \  -d '{    "model": "anthropic/claude-sonnet-4.5",    "messages": [      {        "role": "user",        "content": "hi"      }    ]  }'
{  "input_tokens": 812}