Messages
POST /v1/messages: Anthropic format for Claude Code and similar clients.
POST https://ai.sivcloud.com/v1/messages uses the Anthropic Messages format. Claude Code and the Anthropic SDK use it.
curl https://ai.sivcloud.com/v1/messages \
-H "x-api-key: $SIVCLOUD_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4.1-flash",
"max_tokens": 256,
"messages": [{"role": "user", "content": "Hello"}]
}'
The Authorization: Bearer header is also accepted.
Response
{
"type": "message",
"role": "assistant",
"model": "deepseek-v4.1-flash",
"content": [{"type": "text", "text": "Hello!"}],
"stop_reason": "end_turn",
"usage": {"input_tokens": 20, "output_tokens": 3, "cache_read_input_tokens": 0}
}
cache_read_input_tokens is the input read from cache, and cache_creation_input_tokens is what was written to cache. See Cache.
Count tokens
POST https://ai.sivcloud.com/v1/messages/count_tokens counts the input tokens of a Messages request without creating a message. The body is the same as /v1/messages; system, messages and tools are all counted.
curl https://ai.sivcloud.com/v1/messages/count_tokens \
-H "x-api-key: $SIVCLOUD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "deepseek-v4.1-flash", "messages": [{"role": "user", "content": "Hello"}]}'
{"input_tokens": 9}
The number is a local estimate and can differ slightly from usage in the response. The call is free: it does not touch your balance or allowance and does not appear in the usage log. An API key is still required.
Good to know
max_tokensis required, as in the Anthropic API. The cost reserve is computed from it.- Not every model opens this endpoint. The Models page in the console marks the endpoints of each model.
- Streaming uses
"stream": true. See Streaming. - Claude Code setup is on the Claude Code page.