Messages Format
Create a message response using the official Anthropic Claude Messages API format.
This endpoint only supports Claude models. Do not use OpenAI, DeepSeek, or other non-Claude models on this endpoint.
Try It
POST
/v1/messageshttps://api-platform.ope.aiAuthentication
Use the platform API key.
- Header:
Authorization: Bearer <api-key> - Example:
Authorization: Bearer sk-xxxxxx
You may pass the official Claude anthropic-version header, for example 2023-06-01.
Request Body (application/json)
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Claude model ID |
max_tokens | integer | Yes | Maximum tokens to generate |
messages | array | Yes | Conversation message list |
system | string | array | No | System prompt |
stop_sequences | string[] | No | Custom stop sequences |
stream | boolean | No | Whether to use SSE streaming |
temperature | number | No | Sampling temperature |
top_p | number | No | Nucleus sampling parameter |
top_k | integer | No | Top-k sampling parameter |
tools | array | No | Official Claude tool definition array |
tool_choice | object | No | Tool selection strategy |
thinking | object | No | Extended thinking configuration |
metadata | object | No | Metadata |
messages
| Field | Type | Required | Description |
|---|---|---|---|
role | string | Yes | user or assistant |
content | string | array | Yes | Text content or an official Claude content block array |
Request Examples
- cURL
- JavaScript
- Python
curl -X POST "https://api-platform.ope.ai/v1/messages" \
-H "Authorization: Bearer $OPEAI_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, Claude"
}
]
}'
const res = await fetch("https://api-platform.ope.ai/v1/messages", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.OPEAI_API_KEY}`,
"anthropic-version": "2023-06-01",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "claude-sonnet-4-5",
max_tokens: 1024,
messages: [{role: "user", content: "Hello, Claude"}],
}),
});
console.log(await res.json());
import os
import requests
resp = requests.post(
"https://api-platform.ope.ai/v1/messages",
headers={
"Authorization": f"Bearer {os.environ['OPEAI_API_KEY']}",
"anthropic-version": "2023-06-01",
},
json={
"model": "claude-sonnet-4-5",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello, Claude"}],
},
timeout=60,
)
print(resp.json())
Response Example
{
"id": "msg_01XFDUDYJgAACzvnptvVoYEL",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello!"
}
],
"model": "claude-sonnet-4-5",
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 12,
"output_tokens": 6
}
}
Official reference: Claude Messages API