Verify Model and Usage
Use call logs and five checks to verify the model, token usage, and cost of each call.
Call Log
Section titled “Call Log”Every call is recorded in the console’s call log, listing the model, input, output, cache read, and cache write token usage, as well as the cost.
Five Checks
Section titled “Five Checks”The following checks compare against the public format of the Anthropic API to detect differences in returned fields and format.
| Check | Expected Result | What to Watch For |
|---|---|---|
1. Returned model field | Matches the requested model ID | Returns a different model name, or the field is missing |
| 2. Cache read | The same request meeting cache conditions is sent twice within the cache validity period; the second cache_read_input_tokens is greater than 0 | Always 0, or no cache fields in usage |
| 3. Tool call ID | The id of the tool_use block starts with toolu_ | Other formats, or the model does not call tools as required |
| 4. Streaming event order | message_start, content_block_start, content_block_delta, message_delta, and message_stop appear in sequence | Only OpenAI-format data: blocks, or events missing or out of order |
| 5. Real task comparison | Use a fixed task and compare results with the official API or other trusted sources | Results noticeably worse, abnormal refusals, or frequent truncation |
These checks can only detect differences in fields and format; they cannot alone confirm the model actually in use. model fields can be rewritten, and formats can be imitated.
Completing the First Four Checks with a Script
Section titled “Completing the First Four Checks with a Script”Requires bash, curl, and jq. The script makes five small calls, one of which writes approximately 18,000 tokens to cache, billed at the normal price.
#!/usr/bin/env bash# 用法:ONEZHE_API_KEY=sk-你的API密钥 bash verify.sh [模型ID]set -euo pipefailBASE="https://1zheai.com"MODEL="${1:-claude-sonnet-5-5}"H=(-H "x-api-key: $ONEZHE_API_KEY" -H "anthropic-version: 2023-06-01" -H "content-type: application/json")
echo "== 1. model 字段"curl -s "$BASE/v1/messages" "${H[@]}" \ -d "$(jq -n --arg m "$MODEL" '{model:$m,max_tokens:16,messages:[{role:"user",content:"ping"}]}')" \ | jq 'if .error then .error else {id, model, usage} end'
echo "== 2. 缓存:同一请求发两次,看第二次的 cache_read_input_tokens"LONG=$(printf '这是一段用来测试缓存的固定文本,内容不重要,长度够就行。%.0s' {1..600})BODY=$(jq -n --arg m "$MODEL" --arg t "$LONG" '{model:$m,max_tokens:16, system:[{type:"text",text:$t,cache_control:{type:"ephemeral"}}], messages:[{role:"user",content:"ping"}]}')for i in 1 2; do curl -s "$BASE/v1/messages" "${H[@]}" -d "$BODY" | jq -c 'if .error then .error else .usage end'done
echo "== 3. 工具调用 ID"curl -s "$BASE/v1/messages" "${H[@]}" \ -d "$(jq -n --arg m "$MODEL" '{model:$m,max_tokens:256, tools:[{name:"get_weather",description:"查询城市天气", input_schema:{type:"object",properties:{city:{type:"string"}},required:["city"]}}], tool_choice:{type:"auto"}, messages:[{role:"user",content:"北京今天天气怎么样"}]}')" \ | jq -r 'if .error then .error.message else (.content[]? | select(.type=="tool_use") | .id) end'
echo "== 4. 流式事件序列"curl -sN "$BASE/v1/messages" "${H[@]}" \ -d "$(jq -n --arg m "$MODEL" '{model:$m,max_tokens:32,stream:true,messages:[{role:"user",content:"数到三"}]}')" \ | grep '^event:' | uniqCheck 3 uses tool_choice: auto. 5.x models such as Sonnet 5.5 do not support forcing tool specification ({"type":"tool"} or {"type":"any"}) and will return a 400 does not support forced tool_choice.
The output from testing with claude-sonnet-5-5 on 2026-10-15 is as follows (Check 1 only retains key fields):
== 1. model 字段{ "id": "msg_011Cg3Esh8zeEdLeXAPVALKe", "model": "claude-sonnet-5-5", "usage": { "input_tokens": 518, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0, "output_tokens": 12, ... }}== 2. 缓存:同一请求发两次,看第二次的 cache_read_input_tokens{"input_tokens":23,"cache_creation_input_tokens":17920,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":17920,"ephemeral_1h_input_tokens":0},"output_tokens":4,"output_tokens_details":{"thinking_tokens":0},"service_tier":"standard","inference_geo":"global"}{"input_tokens":23,"cache_creation_input_tokens":0,"cache_read_input_tokens":17920,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":4,"output_tokens_details":{"thinking_tokens":0},"service_tier":"standard","inference_geo":"global"}== 3. 工具调用 IDtoolu_01UPsdyKX8M9fJTTkDoSKHXA== 4. 流式事件序列event: message_startevent: content_block_startevent: pingevent: content_block_deltaevent: content_block_stopevent: message_deltaevent: message_stopWhether the ping event appears and where it appears is not fixed and does not affect the judgment.
thinking Blocks
Section titled “thinking Blocks”When thinking is enabled, the returned thinking block includes a signature field, which can also serve as a format check. The syntax for 5.x models differs from 4.x; tested on 2026-10-15:
| Model | thinking Parameter | Result |
|---|---|---|
claude-sonnet-4-6 | {"type":"enabled","budget_tokens":1024} | Returns a thinking block with thinking text and signature |
claude-sonnet-5 | {"type":"enabled","budget_tokens":1024} or {"type":"adaptive"} | Both work |
claude-sonnet-5-5 | {"type":"adaptive"} | Works; passing enabled returns 400, indicating only adaptive is supported |
The thinking block of 5.x models contains only signature by default, with the thinking text as an empty string. To see the thinking summary, add "display": "summarized":
"thinking": {"type": "adaptive", "display": "summarized"}When using third-party detection websites, it is recommended to create a dedicated API key and delete it after testing.
When Inconsistencies Are Found
Section titled “When Inconsistencies Are Found”Send an email to [email protected] with the request time, model ID, complete response content (with the API key removed), and the corresponding check item. The request id in the response content or error message can help locate this call.
Is asking the model "Who are you?" reliable?
Unreliable. The model’s self-introduction is influenced by the system prompt, and under certain prompts it may answer its own version incorrectly. Checking the returned fields and event format is more informative.
Opus is selected — why does Haiku appear in the call logs?
Claude Code uses the Haiku model for some background tasks, and corresponding records will appear in the call log. You can use the ANTHROPIC_DEFAULT_HAIKU_MODEL environment variable to specify the model used for such tasks; see Claude Code integration. If this occurs when not using Claude Code, please send the request time to [email protected].
