Skip to content

Claude Sonnet 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 Sonnet 5.5default · thinking on · Claude Code 2.1.299 (headless -p) · cloud · 2026-10-16 · by @bobsiopener

Trust 80%Fully autonomoussuccess · first try
Estimated cost
$0.07
Wall time
23s
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-sonnet-5.5: $0.073298. 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.07
Wall time
23s
Human step-ins
0
Turns
6
Model usage
ModelInput tokOutput tokCost
AClaude Sonnet 5.5anthropic/claude-sonnet-5.5effort default (no --effort flag) · thinking on83,8362,485$0.07

Reproduce this run

  1. Use the use case prompt on the use case page.
  2. Same setup: Claude Sonnet 5.5 (anthropic/claude-sonnet-5.5, effort default (no --effort flag) · thinking on) via Claude Code 2.1.299 (headless -p), cloud.
  3. 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.
  4. 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?

⇄ Rerun on another model

Automated checks

Trust 80% comes from these checks (how Trust % works).

Evidence log
[
 {
  "duration_api_ms": 19370,
  "stop_reason": "end_turn",
  "session_id": "[REDACTED]",
  "total_cost_usd": 0.0732979,
  "usage": {
   "input_tokens": 8,
   "cache_creation_input_tokens": 10269,
   "cache_read_input_tokens": 73559,
   "output_tokens": 2485,
   "output_tokens_details": {
    "thinking_tokens": 80
   },
   "server_tool_use": {
    "web_search_requests": 0,
    "web_fetch_requests": 0
   },
   "service_tier": "standard",
   "cache_creation": {
    "ephemeral_1h_input_tokens": 10269,
    "ephemeral_5m_input_tokens": 0
   },
   "inference_geo": "global",
   "iterations": [
    {
     "input_tokens": 2,
     "output_tokens": 367,
     "cache_read_input_tokens": 22306,
     "cache_creation_input_tokens": 502,
     "cache_creation": {
      "ephemeral_5m_input_tokens": 0,
      "ephemeral_1h_input_tokens": 502
     },
     "type": "message"
    }
   ],
   "speed": "standard",
   "fallback_credit": null
  },
  "modelUsage": {
   "claude-sonnet-5-5": {
    "inputTokens": 8,
    "outputTokens": 2485,
    "cacheReadInputTokens": 73559,
    "cacheCreationInputTokens": 10269,
    "webSearchRequests": 0,
    "costUSD": 0.0732979,
    "contextWindow": 1000000,
    "maxOutputTokens": 128000,
    "thinkingTokens": 80,
    "canonicalModel": "claude-sonnet-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` (stdlib only), and it passed my test run against the mock server.\n\n- **`list_items`:** returned all 57 items at limit 20, 7 and 50. The last item at limit 50 was `it_057`.\n- **`get_item`:** returned `it_003`. A missing ID raised `ApiError` with status 404.\n- **`update_item`:** the mock bumps `it_007` externally on the first PATCH, so that call got a 412. The client re-fetched, retried, and returned the updated item at version 3 with `name` \"Changed elsewhere\" and `qty` 9.\n- **Errors:** an invalid `qty` raised `ApiError` with status 422, and a wrong token raised 401.\n- **429 and 503:** the mock returns these on a fixed schedule, so they came up during the run and were retried without any errors reaching the caller. I didn't test the 5-retry limit itself. A 429 waits for `Retry-After`; a 503 backs off exponentially (0.05s, doubling, capped at 2s).\n\nI started the server myself on port 18431 and killed only that process when I finished.",
  "ttft_ms": 1666,
  "type": "result",
  "duration_ms": 22400,
  "uuid": "[REDACTED]",
  "ttft_stream_ms": 1319,
  "time_to_request_ms": 224,
  "first_content_frame_ms": 1319,
  "queued_turn_count": 0,
  "result_index": 0
 }
]

Get new runs and ranking changes weekly