{"slug": "show-hn-claude-hot-path-one-file-claude-clients-in-7-languages-no-sdk", "title": "Show HN: Claude Hot Path, one-file Claude clients in 7 languages, no SDK", "summary": "A Show HN benchmark by Andy Cross, published at stepinto.dev, measured hand-written one-file Claude API clients in seven languages and found a C client added 2.81 ms of client time per request, versus 592.47 ms for the official Python `anthropic` SDK used as a reference row. The C client started cold in 1.3 ms with 6.1 MB peak memory, while the Python SDK took 464.62 ms to cold start at 84.1 MB; Rust (3.16 ms), tuned C# (3.35 ms), Zig (3.67 ms) and Go (4.42 ms) followed, with bash and curl at 35.3 ms and standard-library Python at 140.37 ms. Each client implements one HTTPS POST to /v1/messages and a stream of six Server-Sent Event types by hand, and the harness checks required behaviors such as reading ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL and posting with anthropic-version 2023-06-01, measuring a median of 100 cold starts under Docker against a mock server that replays recorded exchanges.", "body_md": "The fastest way from your code to Claude. One file, no SDK.\n\nThe hot path to Claude is one HTTPS POST and a stream of six Server-Sent Event types. Each client here writes it by hand in one source file, in one language, and the harness measures what it adds on top of the API: cold start, the turnaround between the two requests of a tool call, memory, and size. The leaderboard sorts by the milliseconds added, fastest first.\n\nPosts about each one are at [https://stepinto.dev/claude-hot-path/](https://stepinto.dev/claude-hot-path/).\n\nMedian of 100 cold starts for each client, under Docker, against the mock server. Client time is every millisecond the mock was not streaming: cold start, turnaround and exit added together.\n\n| Client | Client time | Cold start | Turnaround | Peak memory | Ships | Lines | Post | \n|---|---|---|---|---|---|---|---|\n| [C](https://github.com/AndyCross/claude-hot-path/blob/main/clients/c) | **2.81 ms** | 1.3 ms | 0.67 ms | 6.1 MB | 2.1 MB | 271 |  | \n| [Rust](https://github.com/AndyCross/claude-hot-path/blob/main/clients/rust) | **3.16 ms** | 1.14 ms | 0.73 ms | 3.0 MB | 3.3 MB | 184 | [read](https://stepinto.dev/hot-path/a-claude-client-in-one-rust-file-and-the-first-dependency/) | \n| [C#, tuned](https://github.com/AndyCross/claude-hot-path/blob/main/clients/csharp-tuned) | **3.35 ms** | 1.67 ms | 0.73 ms | 4.3 MB | 10.4 MB | 344 | [read](https://stepinto.dev/hot-path/a-faster-c-claude-client-by-breaking-the-rules/) | \n| [Zig](https://github.com/AndyCross/claude-hot-path/blob/main/clients/zig) | **3.67 ms** | 1.39 ms | 0.99 ms | 2.3 MB | 488 KB | 179 | [read](https://stepinto.dev/hot-path/a-claude-client-in-one-zig-file-under-half-a-megabyte/) | \n| [Go](https://github.com/AndyCross/claude-hot-path/blob/main/clients/go) | **4.42 ms** | 1.73 ms | 1.1 ms | 6.4 MB | 5.8 MB | 156 | [read](https://stepinto.dev/hot-path/a-claude-client-in-one-go-file/) | \n| [C#, ahead-of-time](https://github.com/AndyCross/claude-hot-path/blob/main/clients/csharp) | **7.09 ms** | 3.01 ms | 1.4 ms | 7.1 MB | 7.8 MB | 102 | [read](https://stepinto.dev/hot-path/a-claude-client-in-one-c-file-compiled-ahead-of-time/) | \n| [bash and curl](https://github.com/AndyCross/claude-hot-path/blob/main/clients/bash) | **35.3 ms** | 6.98 ms | 19.09 ms | 11.8 MB | 23.7 MB | 75 | [read](https://stepinto.dev/hot-path/the-hot-path-to-claude-is-a-shell-script/) | \n| [Python, standard library](https://github.com/AndyCross/claude-hot-path/blob/main/clients/python) | **140.37 ms** | 123.78 ms | 1.9 ms | 21.2 MB | 35.5 MB | 90 |  | \n| [Python, official SDK](https://github.com/AndyCross/claude-hot-path/blob/main/clients/python-sdk) | **592.47 ms** | 464.62 ms | 8.65 ms | 84.1 MB | 71.9 MB | 55 |  | \n\n\"Ships\" is the artefact plus any runtime it needs. The Python SDK row is the reference and is not an entry: it uses the official `anthropic` package the way its documentation says. The full board, with p95 figures, toolchain versions and the commit each row was measured at, is [`results/leaderboard.csv`](https://github.com/AndyCross/claude-hot-path/blob/main/results/leaderboard.csv).\n\n```\n./bench/bench.sh bash          # build the bash client, check it, measure 100 cold starts\n./bench/bench.sh all           # every client, then results/leaderboard.csv\n```\n\nYou need Docker and Python 3. You do not need an API key: the mock server in\n`mock/` replays recorded exchanges with their original timing. The only step\nthat talks to Anthropic is recording, which proxies one real exchange through\nthe mock and saves it:\n\n```\nANTHROPIC_API_KEY=... ./bench/bench.sh record bash\n```\n\nThe key is read from your shell by the proxy. The client under test is given a placeholder and never sees it, and nothing writes it to disk.\n\nEvery client must do the following, and the bench checks each point rather than trusting the code.\n\n1. Read the key from `ANTHROPIC_API_KEY` and the base URL from`ANTHROPIC_BASE_URL` (default`https://api.anthropic.com` ). Nothing else\nfrom the environment.\n2. Read the prompt from stdin.\n3. `POST /v1/messages` with headers`x-api-key` ,`anthropic-version: 2023-06-01` and`content-type: application/json` , and a body with`model` ,`max_tokens` ,`stream: true` ,`messages` and`tools` .\n4. Print each `text_delta` as it arrives. The bench checks that the first\nvisible byte reached stdout before the mock finished sending the stream\nthat carried it, so buffering the reply, or flushing only on newlines,\nfails.\n5. Declare one tool, `local_time` , taking an IANA`timezone` . When the stream\nends with`stop_reason: \"tool_use\"` , assemble the`input_json_delta` fragments, run the tool, send the`tool_result` in a second request with the\nassistant turn echoed back, and stream that reply too.\n6. On a non-2xx response, print the body's `error.message` to stderr and exit\nnon-zero.\n7. One source file. HTTP and TLS from the platform where it has them. Where it does not, one named library, which counts towards size.\n\n`clients/csharp-tuned/` is the same spec written for speed rather than the\nway the templates say: libc's socket calls and hand-written HTTP/1.1 in place\nof `HttpClient`, `Utf8JsonReader` in place of `JsonNode`, bare file\ndescriptors in place of `Console`, `_exit` in place of runtime shutdown, and\na static musl build from `scratch`. It bends rule 7, so it sits on the board\nas its own row next to the stock `csharp` client rather than replacing it.\n\n| Column | Meaning | \n|---|---|\n| `artefact_bytes` | The stripped binary, or the source file for an interpreted language. | \n| `runtime_bytes` | Zero for a static binary. The interpreter and any shared runtime otherwise, measured inside the image. | \n| `cold_start_ms` | Process spawn to the mock receiving the first request. Median and p95. | \n| `turnaround_ms` | First reply finished to second request received: parse the stream, run the tool, build and send the next request. | \n| `tail_ms` | Second reply finished to exit. | \n| `client_ms` | The sum of the three: every millisecond the mock was not streaming. Median and p95. | \n| `max_rss_kb` | Peak resident memory, from the kernel's rusage for the child. | \n| `source_lines` | Non-blank, non-comment lines in the one source file. Manifests (Cargo.toml, the csproj) are not counted. | \n| `build_s` | Clean image build, reported and not ranked. | \n\nThe streaming check uses the same clocks: the runner notes when the first\nnon-whitespace byte reached stdout and the mock notes when it wrote each chunk,\nand the first must come before the last. On the recorded fixture a streaming\nclient has about 11 ms in hand and a buffering one is 0.3 to 1 ms late, which\nthe check catches. All timings are differences between timestamps the mock recorded and the\nrunner's spawn and exit times, which share a clock because the containers share\na kernel. Nothing is subtracted, so the mock's own sleep overshoot never counts\nagainst a client. The leaderboard sorts by `client_ms`, fastest first. Nothing is\nmeasured over the network: the one real exchange is for conformance, and no\ntiming from it is published.\n\nMake `clients/<name>/` with the source file, a `Dockerfile` whose `ENTRYPOINT`\nruns it, and a `meta.env`:\n\n```\nNAME=zig\nKIND=binary            # interpreted, or sdk for an official-SDK baseline row\nARTIFACT=/app/client   # path inside the image\nRUNTIME=''             # interpreter binaries, for interpreted and sdk\nRUNTIME_DIRS=''        # directories priced whole, e.g. a stdlib and site-packages\nSOURCE=client.zig      # the one file, for the lines column\n```\n\nWrite `/toolchain.txt` in the image during the build; the bench reads it.\n\nThen `./bench/bench.sh <name>`. CI runs the mock bench on every pull request.\n\n[MIT](https://github.com/AndyCross/claude-hot-path/blob/main/LICENSE).", "url": "https://wpnews.pro/news/show-hn-claude-hot-path-one-file-claude-clients-in-7-languages-no-sdk", "canonical_source": "https://github.com/AndyCross/claude-hot-path", "published_at": "2026-11-23 11:33:58+00:00", "updated_at": "2026-11-23 11:44:24.547477+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "large-language-models", "ai-infrastructure"], "entities": ["Andy Cross", "Claude", "Anthropic", "stepinto.dev", "Docker", "Python", "Rust", "Zig"], "also_reported_by": [], "takeaway": "Skipping the official SDK for a hand-written HTTPS POST to /v1/messages cut client-added time from 592.47 ms (Python SDK) to 2.81 ms in C, with cold start falling from 464.62 ms to 1.3 ms and peak memory from 84.1 MB to 6.1 MB.", "recommendation": {"advice": "For latency- or memory-sensitive Claude calls, replace the official SDK with a minimal hand-written client: the C version added 2.81 ms versus 592.47 ms for the Python SDK and used 6.1 MB versus 84.1 MB peak memory.", "playbook": "llm-cost", "playbook_url": "https://wpnews.pro/playbooks/llm-cost"}, "alternates": {"html": "https://wpnews.pro/news/show-hn-claude-hot-path-one-file-claude-clients-in-7-languages-no-sdk", "markdown": "https://wpnews.pro/news/show-hn-claude-hot-path-one-file-claude-clients-in-7-languages-no-sdk.md", "text": "https://wpnews.pro/news/show-hn-claude-hot-path-one-file-claude-clients-in-7-languages-no-sdk.txt", "jsonld": "https://wpnews.pro/news/show-hn-claude-hot-path-one-file-claude-clients-in-7-languages-no-sdk.jsonld"}}