The native Anthropic Messages API. All Claude models and glm-5.1 support it, along with Claude-native features such as extended thinking and prompt caching. Claude Code uses this API too.
The Anthropic SDK appends /v1/messages itself, so set base_url to https://studio.dataeyes.ai.
Response:
{"id":"msg_xxx","type":"message","role":"assistant","model":"claude-sonnet-5-5","content":[{"type":"text","text":"I'm Claude, an AI assistant made by Anthropic, here to help with questions, writing, analysis, and more."}],"stop_reason":"end_turn","usage":{"input_tokens":31,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":40}}
Claude 5 models use adaptive thinking: the model decides whether and how long to think based on the problem, and output_config.effort sets the tendency (low, medium, high).
When the model thinks, content returns a thinking block first, then a text block. Thinking tokens count toward output_tokens:
In adaptive mode, the model may skip thinking on simple questions and return only a text block. This is expected.
Claude 4.x models use a fixed budget instead: "thinking": {"type": "enabled", "budget_tokens": 2048}, where budget_tokens must be less than max_tokens.
Add cache_control to long content that you reuse (system prompts, long documents, tool definitions). When later requests hit the cache, that part of the input is billed at the cache-read rate.
How usage changes when the same content is sent twice in a row (measured, with about 2,500 cached tokens):
Request
cache_creation_input_tokens
cache_read_input_tokens
input_tokens
1st: writes the cache
2535
0
22
2nd: hits the cache
0
2535
22
TIP
Content that is too short is not cached (the minimum length varies by model), and it must match the earlier request exactly. Content up to and including the cache_control marker is cached. For cache read and write pricing, see the Model Hub.