Messages (Anthropic format)
POST https://api.vikey.ai/v1/messagesThe request and response follow the Anthropic Messages API. Claude Code and the Anthropic SDK use this endpoint. Every text model on Vikey can be called through it, including GPT and DeepSeek.
Example
Section titled “Example”curl https://api.vikey.ai/v1/messages \ -H "x-api-key: YOUR_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "anthropic/claude-sonnet-5.5", "max_tokens": 1024, "system": "Answer briefly.", "messages": [{"role": "user", "content": "What is the difference between let and const in JavaScript?"}] }'Authorization: Bearer YOUR_API_KEY is also accepted instead of x-api-key.
Common parameters
Section titled “Common parameters”| Parameter | Notes |
|---|---|
model |
Required. A Vikey model id. |
max_tokens |
Required in the Anthropic format. Also used for the balance check. |
messages |
Required. user and assistant messages with text or content blocks (text, images, tool_use, tool_result). |
system |
System prompt, as text or an array of blocks. |
stream |
true for an Anthropic-format event stream. |
tools, tool_choice |
Tool use in the Anthropic format. |
cache_control |
Cache markers on content blocks are passed to models that support them. |
Response
Section titled “Response”{ "id": "msg_...", "type": "message", "role": "assistant", "model": "anthropic/claude-sonnet-5.5", "content": [{"type": "text", "text": "let can be reassigned, const cannot..."}], "stop_reason": "end_turn", "usage": {"input_tokens": 32, "output_tokens": 58}}Errors use the Anthropic shape: {"type": "error", "error": {"type": "...", "message": "..."}}. See Errors.