Messages API
Send prompts to Claude Opus 4.6, Sonnet 4.6 & Haiku 4.5 via the Messages API. OpenAI-compatible. Code examples, request/response format, streaming support.
Method: POST. URL: https://api2.claudestore.store/v1/messages. Required fields: model, max_tokens, messages. Streaming: Set stream: true (SSE). Anthropic SDK: 100% compatible.
Endpoint
POST https://api2.claudestore.store/v1/messages
POST https://api2.claudestore.store/v1/messagesGateway v2 (sk-cs2-* keys)
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model ID (e.g., claude-sonnet-4.6) |
| messages | array | Yes | Array of message objects with role and content |
| max_tokens | integer | Yes | Maximum tokens to generate |
| system | string | No | System prompt |
| stream | boolean | No | Enable streaming (default: false) |
| temperature | number | No | Sampling temperature (0-1) |
| top_p | number | No | Nucleus sampling parameter |
| top_k | integer | No | Top-k sampling parameter |
| stop_sequences | array | No | Custom stop sequences |
Example Request
Messages API Requestbash
curl https://api2.claudestore.store/v1/messages \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-sonnet-4.6",
"max_tokens": 1024,
"system": "You are a helpful assistant.",
"messages": [
{"role": "user", "content": "Explain quantum computing in one paragraph."}
]
}'Response
Example Responsejson
{
"id": "msg_01XFDUDYJgAACzvnptvVoYEL",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Quantum computing leverages quantum mechanical phenomena..."
}
],
"model": "claude-sonnet-4.6",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 25,
"output_tokens": 150
}
}Streaming
Set "stream": true in the request body to receive Server-Sent Events. See the Streaming page for details.
Tool Use
Tool use (function calling) is supported through the standard Anthropic
tools parameter. Pass tool definitions in your request and Claude will generate structured tool calls when appropriate.