Claude Opus 5.5 (effort default (no --effort flag) · thinking on) on Implement an API client from a written spec against a flaky local mock server (429/503/412 ETag)
AClaude Opus 5.5default · thinking on · Claude Code 2.1.299 (headless -p) · cloud · 2026-10-16 · by @bobsiopener
- Estimated cost
- $0.18
- Wall time
- 37s
- Human step-ins
- 0
- Outcome
- Pass
Compare with other models on this task →
Summary
Exact prompt
# Task: write an API client from a spec Read `API_SPEC.md`. Write `client.py` (stdlib only: urllib/http.client/json/time) exposing: ```python class ApiError(Exception): # has .status (int) and .body (dict) class Client: def __init__(self, base_url: str, token: str): ... def list_items(self, limit: int = 20) -> list[dict] # ALL items across all pages, in order def get_item(self, item_id: str) -> dict # raises ApiError(404) if missing def update_item(self, item_id: str, **fields) -> dict # optimistic concurrency: GET for ETag, PATCH with If-Match; on 412 re-fetch and retry (up to 3 times); returns updated item ``` All calls must handle 429 (honour Retry-After) and 503 (retry with backoff) transparently, up to 5 retries; other errors raise ApiError. A mock server is provided: `python server.py 18431` (token `secret-token`) — start it yourself to test, and STOP it when you are done (kill only the PID you started). No network beyond 127.0.0.1.
Retry-After handling, pagination tokens, optimistic concurrency with a forced conflict, typed errors. Mock injects deterministic faults. Original benchmark task written for usecaserank.com (not based on a specific public post). Headless, offline run on a reproducible fixture. Each run's notes say how its cost was measured (estimates are marked).
Success criteria: 1. Scorer starts the mock server on port 18431 (override D05_PORT), kills only that PID afterwards, and runs 6 hidden pytest tests; pytest must exit 0 (120 s timeout). 2. Tests: list_items returns all items across pages in order; get_item works and raises ApiError with status 404 for a missing id; wrong token raises ApiError with status 401; update_item succeeds and increments version; update_item recovers from a forced 412 conflict by re-fetching and retrying; invalid qty raises ApiError 422 with body field 'qty'. 429 and 503 faults are injected throughout and must be handled transparently.
Setup notes: Use Case Scout batch 4 case d05-api-client-from-spec (offline fixture). Prepared with batch4/prepare.sh; hidden key/tests kept outside the agent's work dir. Prompt = TASK.md verbatim. Scored with the scout's scorer: `bash score.sh WORKDIR (mock server on port 18431, override D05_PORT)`. Tools: Read/Write/Edit/Glob/Grep/Bash, web disabled. Single run, no retries. Claude Code's own reported cost for claude-opus-5.5: $0.180414. Score: pass. Cost is an ESTIMATE: measured tokens x pricing.json list price (Claude Pro subscription, nothing billed); input_tokens include cache reads and writes. Single run.
Estimated cost List-price estimate; not actually billed.
Metrics
- Estimated cost
- $0.18
- Wall time
- 37s
- Human step-ins
- 0
- Turns
- 6
| Model | Input tok | Output tok | Cost |
|---|---|---|---|
| AClaude Opus 5.5anthropic/claude-opus-5.5effort default (no --effort flag) · thinking on | 106,643 | 3,646 | $0.18 |
Reproduce this run
- Use the use case prompt on the use case page.
- Same setup: Claude Opus 5.5 (anthropic/claude-opus-5.5, effort default (no --effort flag) · thinking on) via
Claude Code 2.1.299 (headless -p), cloud. - It counts as a success only if it meets every success criterion: 1. Scorer starts the mock server on port 18431 (override D05_PORT), kills only that PID afterwards, and runs 6 hidden pytest tests; pytest must exit 0 (120 s timeout). 2. Tests: list_items returns all items across pages in order; get_item works and raises ApiError with status 404 for a missing id; wrong token raises ApiError with status 401; update_item succeeds and increments version; update_item recovers from a forced 412 conflict by re-fetching and retrying; invalid qty raises ApiError 422 with body field 'qty'. 429 and 503 faults are injected throughout and must be handled transparently.
- Log model, tokens, wall time, human step-ins and the evidence log, then submit it as a reproduction. A different model? Submit a head-to-head rerun.
How runs are scored: Methodology.
Was this useful?
Automated checks
Trust 80% comes from these checks (how Trust % works).
- Run date is not in the future : passed
- Model is in the dated pricing table : passed
- Cost recomputed from tokens matches : passed
- Cached tokens are consistent : passed
- Output throughput is plausible : passed
- Autonomy matches step-ins : passed
- Step-ins do not exceed turns : passed
- Retries agree with first-try result : passed
- Evidence log SHA-256 matches : passed
- Evidence log is substantial : passed
Evidence log
[
{
"duration_api_ms": 32650,
"stop_reason": "end_turn",
"session_id": "[REDACTED]",
"total_cost_usd": 0.1804142,
"usage": {
"input_tokens": 10,
"cache_creation_input_tokens": 11042,
"cache_read_input_tokens": 95591,
"output_tokens": 3646,
"output_tokens_details": {
"thinking_tokens": 273
},
"server_tool_use": {
"web_search_requests": 0,
"web_fetch_requests": 0
},
"service_tier": "standard",
"cache_creation": {
"ephemeral_1h_input_tokens": 11042,
"ephemeral_5m_input_tokens": 0
},
"inference_geo": "global",
"iterations": [
{
"input_tokens": 2,
"output_tokens": 759,
"cache_read_input_tokens": 22920,
"cache_creation_input_tokens": 268,
"cache_creation": {
"ephemeral_5m_input_tokens": 0,
"ephemeral_1h_input_tokens": 268
},
"type": "message"
}
],
"speed": "standard",
"fallback_credit": null
},
"modelUsage": {
"claude-opus-5-5": {
"inputTokens": 10,
"outputTokens": 3646,
"cacheReadInputTokens": 95591,
"cacheCreationInputTokens": 11042,
"webSearchRequests": 0,
"costUSD": 0.1804142,
"contextWindow": 1000000,
"maxOutputTokens": 128000,
"thinkingTokens": 273,
"canonicalModel": "claude-opus-5-5",
"provider": "firstParty",
"costBasis": "list"
}
},
"permission_denials": [],
"terminal_reason": "completed",
"fast_mode_state": "off",
"fast_mode_disabled_reason": "sdk_opt_in_required",
"subagent_stats": {
"spawned": 0,
"requested": {
"background": 0,
"foreground": 0,
"unset": 0
},
"started_in_background": 0,
"max_depth": 0,
"spawned_by_subagents": 0,
"completed": 0,
"failed": 0,
"killed": {
"parent": 0,
"user": 0,
"system": 0
},
"refused": {
"depth_limit": 0,
"concurrency_limit": 0,
"budget": 0
},
"by_type": {}
},
"safety_stops": 0,
"is_error": false,
"num_turns": 6,
"subtype": "success",
"api_error_status": null,
"result": "I wrote `client.py` and it passes every test I ran against the mock server. I started the server myself and stopped it afterwards by its own PID (605987); it's confirmed not running.\n\n**How it works**\n- **`ApiError`** has `.status` and `.body`. If an error response isn't valid JSON, `.body` is `{\"raw\": \"<text>\"}` instead.\n- **Retries:** every call goes through one request helper. It retries 429 and 503 up to 5 times (6 attempts in total).\n - On 429 it waits for the `Retry-After` value, which can be fractional. If the header is missing or can't be read, it falls back to the backoff delay.\n - On 503 it uses exponential backoff, starting at 0.1s and doubling up to a 5s cap.\n - Any other error, or running out of retries, raises `ApiError`.\n- **`list_items(limit)`** follows `next_page_token` until it is null and returns every item in order. It clamps `limit` to 1\u201350, as the spec requires.\n- **`get_item`** raises `ApiError` with status 404 and body `{\"error\":\"not_found\"}` when the item doesn't exist.\n- **`update_item`** fetches the item to get its ETag, then sends the PATCH with `If-Match`. On a 412 it fetches again and retries up to 3 more times (4 attempts in total), then raises the 412. A 422 or any other error is raised straight away.\n\n**What the tests covered** (`/tmp/d05_test/test_client.py`)\n- Listing returns all 57 items in order with `limit` set to 7, 20 and 50.\n- A missing item gives a 404, a bad token gives a 401, and a negative `qty` gives a 422 with `field: \"qty\"`.\n- Updating `it_007` works even though the server simulates another writer changing it, so the 412 re-fetch path ran. The result has version 3.\n- 30 repeated GETs go through cleanly despite the server's regular 429 and 503 responses.\n\nTwo cases were not tested: running out of the 412 retries, and running out of the 429/503 retries. The mock server never gets into either state.",
"ttft_ms": 2391,
"type": "result",
"duration_ms": 36871,
"uuid": "[REDACTED]",
"ttft_stream_ms": 1209,
"time_to_request_ms": 223,
"first_content_frame_ms": 1209,
"queued_turn_count": 0,
"result_index": 0
}
]