POST https://api.ticonai.com/v1/messages follows the Anthropic Messages format, so Anthropic SDKs work after you change the base URL and key. The model catalog and wallet are the same as for chat completions.
curl -sS https://api.ticonai.com/v1/messages \
-H "x-api-key: $AIP_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "your-model-id",
"max_tokens": 80,
"system": "You answer in one short sentence.",
"messages": [{ "role": "user", "content": "What is a prepaid wallet?" }]
}'Send the key as x-api-key or as Authorization: Bearer. The anthropic-version header is optional; if present it must be a date like 2023-06-01. See Authentication.
Request fields
| Field | Type | Notes |
|---|---|---|
model | string, required | A model id from GET /v1/models. |
max_tokens | integer, required | Upper bound on generated tokens. A value above the model's maximum output is lowered to that maximum. |
messages | array, required | At least one message with role user or assistant. content is a string or an array of blocks. |
system | string or array of text blocks | The system prompt. |
temperature | number, 0 to 1 | |
top_p | number, 0 to 1 | |
stop_sequences | array of up to 16 strings | |
stream | boolean | true returns server-sent events. See Streaming. |
tools, tool_choice | any | Accepted and forwarded to the model. |
Other fields are accepted and ignored in this release. The request body limit and content type rules are the same as for chat completions.
Response
{
"id": "msg_0123456789abcdef",
"type": "message",
"role": "assistant",
"model": "your-model-id",
"content": [{ "type": "text", "text": "A prepaid wallet holds money you add before you spend it." }],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": { "input_tokens": 31, "output_tokens": 14, "cache_read_input_tokens": 0 }
}stop_reasonisend_turn,max_tokens,tool_useorrefusal.usage.input_tokensdoes not include cached tokens; cached tokens are reported separately incache_read_input_tokens. Both are billed.- The content array contains text blocks only.
Errors use the Anthropic envelope
On this endpoint an error body looks like this, and the HTTP status is the reliable signal:
{
"type": "error",
"error": { "type": "billing_error", "message": "Insufficient wallet balance for this request. Top up your wallet and retry." },
"request_id": "req_0123456789abcdef"
}error.type follows the HTTP status: invalid_request_error (400, 405, 409), authentication_error (401), billing_error (402), permission_error (403), not_found_error (404), request_too_large (413), rate_limit_error (429), timeout_error (504), and api_error for everything else. The stable machine code values of the Errors page appear in the OpenAI-style body used by every other endpoint.
curl -sS -o /dev/null -w "%{http_code}" https://api.ticonai.com/v1/messages \
-H "x-api-key: $AIP_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "model": "no-such-model", "max_tokens": 8, "messages": [{ "role": "user", "content": "hi" }] }'