POST /v1/messages
Anthropic-native chat completions. 100% identical request/response shape; tool_choice is the only normalization layer.
Request
http
POST https://api-ai.app/v1/messages
x-api-key: mdf-...
anthropic-version: 2023-06-01
content-type: application/json
{
"model": "claude-sonnet-5-5",
"max_tokens": 1024,
"system": "You are a concise assistant.",
"messages": [
{"role": "user", "content": "Why is the sky blue?"}
]
}Request body
| Field | Type | Required | Notes |
|---|---|---|---|
model | string | yes | One of the supported model IDs (Claude allowlist on /v1/messages) |
messages | array | yes | {role, content} pairs |
max_tokens | int | yes | Hard cap on output |
system | string | no | System prompt |
temperature | 0.0–1.0 | no | |
top_p | 0.0–1.0 | no | |
top_k | int | no | |
stop_sequences | array | no | |
stream | bool | no | See Streaming |
tools | array | no | See Tool use |
tool_choice | object | no | Normalized — see tools page |
Prompt caching
Mark up to four cache breakpoints with cache_control: {"type": "ephemeral"} on text or system blocks. Cached tokens are billed at 10% of the normal input rate (and the upstream returns cache_read_input_tokens in usage).
json
{
"model": "claude-sonnet-5-5",
"max_tokens": 1024,
"system": [
{
"type": "text",
"text": "Long stable system prompt that should be cached...",
"cache_control": {"type": "ephemeral"}
}
],
"messages": [{"role": "user", "content": "Question 1"}]
}Response
json
{
"id": "msg_01XYZ...",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-5-5",
"content": [
{"type": "text", "text": "Rayleigh scattering — short wavelengths..."}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 48,
"output_tokens": 92,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0
}
}Anthropic compatibility
Request/response shape is byte-for-byte compatible with the Anthropic Messages API. If your existing code calls
api.anthropic.com today, the only required change is base_url.Last updated: October 2, 2026Found a bug? admin@minedom-france.fr