Create a message
Native Anthropic Messages endpoint — a faithful subset of Anthropic’s public Messages contract, so the Anthropic SDKs and Claude Code work unmodified. Point them at https://api.deutschlandgpt.de/anthropic (self-hosted: https://<your-domain>/platform-api/api/anthropic) and every model hosted on the platform (Claude, GPT, Gemini, Mistral, …) is reachable through this wire format, not just Claude. That base URL is a sibling of the OpenAI-compatible /v2 surface, not a path inside it: the SDK appends /v1/messages itself, so a base URL containing /v2 returns 404.
Authenticate with x-api-key: sk_<id>_<secret> (the Anthropic SDK default) or Authorization: Bearer sk_<id>_<secret>. Responses carry anthropic-version: 2023-06-01.
Supports streaming via SSE (stream: true), tool use, extended thinking (thinking), images and documents, and prompt caching via cache_control breakpoints (honoured on Anthropic-family hosts, a no-op elsewhere). Breakpoints are yours to place: this endpoint caches exactly what you mark and never adds breakpoints of its own, so a request without cache_control is not cached at all. ttl: "1h" is supported on this endpoint — it is Anthropic's own field here, not an extension of ours — and you may mix it with the default 5m in one request (Anthropic's own 1h-prefix/5m-tail pattern), with each bucket billed at its own rate. Anthropic's ordering rule applies: 1h breakpoints must come before any 5m one. Note this is the ONLY endpoint where ttl: "1h" is honoured; /v2/chat/completions and /v2/responses accept it and fall back to five minutes. The per-TTL write split is returned in Anthropic's own usage.cache_creation field, and prompt_cache.warnings reports any marker we could not place exactly as written. See Billing → Prompt caching.
Not supported: server tools (web_search_*, …), the Batches API, and service_tier (accepted but ignored).
https://api.deutschlandgpt.de/anthropic/v1/messagesExample request
curl https://api.deutschlandgpt.de/anthropic/v1/messages \
-X POST \
-H "Authorization: Bearer $DGPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-4.5-sonnet",
"max_tokens": 0,
"messages": [
{
"role": "user",
"content": "string"
}
],
"system": "string",
"tools": [
{
"name": "string"
}
],
"tool_choice": {
"type": "auto"
},
"temperature": 0,
"top_p": 0,
"top_k": 0,
"stop_sequences": [
"string"
],
"stream": false,
"thinking": {
"type": "enabled",
"budget_tokens": 0
},
"metadata": {},
"service_tier": "string"
}'curl https://api.deutschlandgpt.de/anthropic/v1/messages \
-X POST \
-H "Authorization: Bearer $DGPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-4.5-sonnet",
"max_tokens": 0,
"messages": [
{
"role": "user",
"content": "string"
}
],
"system": "string",
"tools": [
{
"name": "string"
}
],
"tool_choice": {
"type": "auto"
},
"temperature": 0,
"top_p": 0,
"top_k": 0,
"stop_sequences": [
"string"
],
"stream": false,
"thinking": {
"type": "enabled",
"budget_tokens": 0
},
"metadata": {},
"service_tier": "string"
}'import os, requests
response = requests.post(
"https://api.deutschlandgpt.de/anthropic/v1/messages",
headers={"Authorization": f"Bearer {os.environ['DGPT_API_KEY']}"},
json={
"model": "claude-4.5-sonnet",
"max_tokens": 0,
"messages": [
{
"role": "user",
"content": "string"
}
],
"system": "string",
"tools": [
{
"name": "string"
}
],
"tool_choice": {
"type": "auto"
},
"temperature": 0,
"top_p": 0,
"top_k": 0,
"stop_sequences": [
"string"
],
"stream": False,
"thinking": {
"type": "enabled",
"budget_tokens": 0
},
"metadata": {},
"service_tier": "string"
},
)
print(response.json())import os, requests
response = requests.post(
"https://api.deutschlandgpt.de/anthropic/v1/messages",
headers={"Authorization": f"Bearer {os.environ['DGPT_API_KEY']}"},
json={
"model": "claude-4.5-sonnet",
"max_tokens": 0,
"messages": [
{
"role": "user",
"content": "string"
}
],
"system": "string",
"tools": [
{
"name": "string"
}
],
"tool_choice": {
"type": "auto"
},
"temperature": 0,
"top_p": 0,
"top_k": 0,
"stop_sequences": [
"string"
],
"stream": False,
"thinking": {
"type": "enabled",
"budget_tokens": 0
},
"metadata": {},
"service_tier": "string"
},
)
print(response.json())const response = await fetch('https://api.deutschlandgpt.de/anthropic/v1/messages', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DGPT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"model": "claude-4.5-sonnet",
"max_tokens": 0,
"messages": [
{
"role": "user",
"content": "string"
}
],
"system": "string",
"tools": [
{
"name": "string"
}
],
"tool_choice": {
"type": "auto"
},
"temperature": 0,
"top_p": 0,
"top_k": 0,
"stop_sequences": [
"string"
],
"stream": false,
"thinking": {
"type": "enabled",
"budget_tokens": 0
},
"metadata": {},
"service_tier": "string"
}),
});
console.log(await response.json());const response = await fetch('https://api.deutschlandgpt.de/anthropic/v1/messages', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DGPT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"model": "claude-4.5-sonnet",
"max_tokens": 0,
"messages": [
{
"role": "user",
"content": "string"
}
],
"system": "string",
"tools": [
{
"name": "string"
}
],
"tool_choice": {
"type": "auto"
},
"temperature": 0,
"top_p": 0,
"top_k": 0,
"stop_sequences": [
"string"
],
"stream": false,
"thinking": {
"type": "enabled",
"budget_tokens": 0
},
"metadata": {},
"service_tier": "string"
}),
});
console.log(await response.json());Request body
modelstringrequiredRegistry model name (e.g. claude-4.5-sonnet, gpt-4o, mistral-large). Every hosted model is reachable through this endpoint — not just Claude. Use /anthropic/v1/models to enumerate.
max_tokensintegerrequiredMaximum number of tokens to generate. Required (unlike the OpenAI-compatible endpoints).
messagesAnthropicMessage[]requiredAlternating user / assistant turns. System instructions go in the top-level system field, not here.
rolestringrequiredcontentstring | AnthropicContentBlock[]requiredA bare string (shorthand for one text block) or a list of content blocks.
systemstring | AnthropicTextBlock[]optionalSystem prompt: a bare string or a list of text blocks (each block can carry a cache_control breakpoint).
toolsAnthropicTool[]optionalCustom tools the model may call. Return each tool_use result in a following user message as a tool_result block.
typestringoptionalOmit, or custom. Other values mark unsupported server tools.
namestringrequireddescriptionstringoptionalWhat the tool does — the model uses this to decide when to call it.
input_schemaobjectoptionalJSON Schema of the tool’s arguments.
cache_controlAnthropicCacheControloptionalPrompt-caching breakpoint. Honoured when the request is served by an Anthropic-family host; a no-op for other providers.
typestringrequiredttlstringoptionalCache time-to-live.
tool_choiceAnthropicToolChoiceoptionalHow the model should use the provided tools.
temperaturenumberoptionalSampling temperature. Higher = more random output.
top_pnumberoptionalNucleus sampling.
top_knumberoptionalOnly sample from the top K options per token.
stop_sequencesstring[]optionalCustom sequences that stop generation.
streambooleanoptionalIf true, respond with server-sent events in Anthropic’s streaming format: message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop.
thinkingAnthropicThinkingConfigoptionalExtended-thinking configuration. Mapped to the equivalent reasoning options of whichever provider hosts the selected model.
metadataobjectoptionalRequest metadata.
user_idstring | nulloptionalOpaque end-user identifier.
service_tierstringoptionalAccepted but ignored — routing is decided server-side.
Response
{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"model": "string",
"content": [
{
"type": "text",
"text": "string"
}
],
"stop_reason": "end_turn",
"stop_sequence": "string",
"usage": {
"input_tokens": 0,
"output_tokens": 0,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0
},
"prompt_cache": {
"cache_write_tokens": {
"5m": 0,
"1h": 0
},
"warnings": [
{
"code": "breakpoint_limit_exceeded",
"message": "string"
}
]
}
}{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"model": "string",
"content": [
{
"type": "text",
"text": "string"
}
],
"stop_reason": "end_turn",
"stop_sequence": "string",
"usage": {
"input_tokens": 0,
"output_tokens": 0,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0
},
"prompt_cache": {
"cache_write_tokens": {
"5m": 0,
"1h": 0
},
"warnings": [
{
"code": "breakpoint_limit_exceeded",
"message": "string"
}
]
}
}The generated message. With stream: true, a text/event-stream of Anthropic streaming events is returned instead.
idstringrequiredtypestringrequiredrolestringrequiredmodelstringrequiredcontentAnthropicResponseContentBlock[]requiredstop_reasonstringrequiredstop_sequencestring | nulloptionalusageAnthropicUsagerequiredinput_tokensintegerrequiredoutput_tokensintegerrequiredcache_creation_input_tokensintegerrequiredTokens written to the prompt cache (0 for providers without prompt caching).
cache_read_input_tokensintegerrequiredTokens served from the prompt cache (0 for providers without prompt caching).
prompt_cacheobjectoptionalDeutschlandGPT extension. What happened to the cache_control breakpoints you sent. Omitted entirely when there is nothing to report, so a request without cache_control is unchanged. See Billing -> Prompt caching.
cache_write_tokensobjectCache-write tokens by TTL, as the upstream host reported them: 125% of the input rate for 5m, 200% for 1h. Both TTLs are honoured on this endpoint.
5mintegerTokens written at the default 5-minute TTL.
1hintegerTokens written at the extended 1-hour TTL.
warningsobject[]Breakpoints that could not be honoured exactly as written. Present only when at least one was affected.
codestringrequiredStable machine-readable reason, so a client can branch without parsing prose.
messagestringrequiredHuman-readable explanation naming the affected position.
Response codes
The generated message. With stream: true, a text/event-stream of Anthropic streaming events is returned instead.
Invalid request body.
AnthropicErrorMissing or invalid API key.
AnthropicErrorModel not found, or the API key has no access to it.
AnthropicError