Skip to content

Claude Haiku 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 Haiku 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.0098
Wall time
45s
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-haiku-5.5: $0.00983. 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.0098
Wall time
45s
Human step-ins
0
Turns
8
Model usage
ModelInput tokOutput tokCost
AClaude Haiku 5.5anthropic/claude-haiku-5.5effort default (no --effort flag) · thinking on179,7329,227$0.0098

Reproduce this run

  1. Use the use case prompt on the use case page.
  2. Same setup: Claude Haiku 5.5 (anthropic/claude-haiku-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": 41587,
  "stop_reason": "end_turn",
  "session_id": "[REDACTED]",
  "total_cost_usd": 0.009829800000000001,
  "usage": {
   "input_tokens": 14,
   "cache_creation_input_tokens": 17988,
   "cache_read_input_tokens": 161730,
   "output_tokens": 9227,
   "output_tokens_details": {
    "thinking_tokens": 4897
   },
   "server_tool_use": {
    "web_search_requests": 0,
    "web_fetch_requests": 0
   },
   "service_tier": "standard",
   "cache_creation": {
    "ephemeral_1h_input_tokens": 17988,
    "ephemeral_5m_input_tokens": 0
   },
   "inference_geo": "global",
   "iterations": [
    {
     "input_tokens": 2,
     "output_tokens": 805,
     "cache_read_input_tokens": 29973,
     "cache_creation_input_tokens": 554,
     "cache_creation": {
      "ephemeral_5m_input_tokens": 0,
      "ephemeral_1h_input_tokens": 554
     },
     "type": "message"
    }
   ],
   "speed": "standard",
   "fallback_credit": null
  },
  "modelUsage": {
   "claude-haiku-5-5": {
    "inputTokens": 14,
    "outputTokens": 9227,
    "cacheReadInputTokens": 161730,
    "cacheCreationInputTokens": 17988,
    "webSearchRequests": 0,
    "costUSD": 0.009829800000000001,
    "contextWindow": 1000000,
    "maxOutputTokens": 128000,
    "thinkingTokens": 4897,
    "canonicalModel": "claude-haiku-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": 8,
  "subtype": "success",
  "api_error_status": null,
  "result": "I wrote `client.py` in the work directory, and it passes an end-to-end test against the mock server. I've stopped the server (PID 621001, the one I started).\n\n**What's in `client.py`** (stdlib only: `urllib`, `json`, `time`)\n- **`ApiError(status, body)`** has `.status` and `.body`, where `body` is always a dict.\n- **`list_items(limit=20)`** follows `next_page_token` until it is null and returns every item in order. It raises `ValueError` if `limit` is outside 1..50.\n- **`get_item(item_id)`** returns the item and raises `ApiError(404)` if it is missing.\n- **`update_item(item_id, **fields)`** GETs the item for its ETag, then PATCHes with `If-Match`. On 412 it re-fetches and retries, up to 3 retries after the first attempt. It returns the updated item.\n- **429 and 503 handling** lives in one `_request` helper that all calls go through. A 429 waits for `Retry-After` (fractional seconds are accepted). A 503 uses exponential backoff from 0.1s, capped at 5s. Each HTTP request gets up to 5 retries.\n\n**Choices I made that you may want to change**\n- The 5-retry budget is per HTTP request, not per `update_item` call. A single `update_item` can therefore make more than 5 retried requests in total.\n- Network failures and timeouts (30s) are wrapped as `ApiError(0, ...)` and are not retried, since the spec only covers 429 and 503.\n- A PATCH is retried on 503 or 429. With `If-Match` this is safe against this server, but a real server could apply a write before returning 503.\n- If a GET response has no ETag, `update_item` raises `ApiError(0, ...)` rather than sending a PATCH without `If-Match`.\n\n**Testing:** I ran a throwaway script against `server.py` on port 18431. It checked that `list_items` returns all 57 items in order, and that `list_items(limit=7)` gives the same result. It also checked that `get_item` returns an existing item and raises 404 for a missing one. `update_item` on `it_007` hits the server's simulated concurrent write, so the first PATCH returns 412 and the retry succeeds. The test also covered a 422 on a bad `qty` and a 401 with a wrong token. Everything passed. I then deleted the test script so the work directory holds only `client.py`.",
  "ttft_ms": 1542,
  "type": "result",
  "duration_ms": 44876,
  "uuid": "[REDACTED]",
  "ttft_stream_ms": 1217,
  "time_to_request_ms": 227,
  "first_content_frame_ms": 1217,
  "queued_turn_count": 0,
  "result_index": 0
 }
]

Get new runs and ranking changes weekly