<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QCode Notes]]></title><description><![CDATA[QCode Notes]]></description><link>https://qcodenotes.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Dec 2026 22:40:12 GMT</lastBuildDate><atom:link href="https://qcodenotes.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Ist dein LLM-API-Relay ehrlich? Claude Code und Codex CLI mit fremder Base-URL einrichten und in 10 Minuten nachmessen]]></title><description><![CDATA[Offenlegung: Ich betreibe qcode.cc, einen unabhängigen API-Dienst (nicht mit Anthropic oder OpenAI verbunden). Dieser Text wurde mit KI-Unterstützung…]]></description><link>https://qcodenotes.hashnode.dev/llm-relay-pruefen-claude-code-codex</link><guid isPermaLink="true">https://qcodenotes.hashnode.dev/llm-relay-pruefen-claude-code-codex</guid><category><![CDATA[claude-code]]></category><category><![CDATA[codex]]></category><category><![CDATA[api]]></category><category><![CDATA[llm]]></category><dc:creator><![CDATA[QCode]]></dc:creator><pubDate>Wed, 02 Dec 2026 02:41:03 GMT</pubDate><content:encoded><![CDATA[<p><em>Offenlegung: Ich betreibe <a href="https://qcode.cc">qcode.cc</a>, einen unabhängigen API-Dienst (nicht mit Anthropic oder OpenAI verbunden). Dieser Text wurde mit KI-Unterstützung geschrieben; Befehle und Zahlen habe ich am 2. Dezember 2026 auf den Live-Seiten geprüft.</em></p>
<p>Wer Claude Code oder Codex CLI über einen Drittanbieter nutzt, also einen Relay, ein eigenes Gateway oder einen Dienst wie unseren, vertraut einem Mittelsmann drei Dinge an: die Latenz, die Rechnung und die Behauptung, dass das bestellte Modell auch das gelieferte ist. Die meisten Anbieter beantworten das mit Adjektiven („schnell“, „stabil“). Hier geht es um Zahlen, die du selbst wiederholen kannst. Die Einrichtung kommt zuerst, kurz. Ausführlich steht sie in meinem <a href="https://medium.com/@hicool/claude-code-und-codex-cli-auf-eine-eigene-base-url-zeigen-7f8695ad4c13">früheren Beitrag</a>.</p>
<h2>1. Einrichtung in zwei Minuten</h2>
<p><strong>Claude Code</strong> spricht das Anthropic-Messages-Protokoll:</p>
<pre><code class="language-bash">export ANTHROPIC_BASE_URL=https://api.qcode.cc/api
export ANTHROPIC_AUTH_TOKEN=cr_dein_key
claude
</code></pre>
<p>Dauerhaft geht das über <code>~/.claude/settings.json</code> mit einem <code>"env"</code>-Block, der dieselben zwei Variablen enthält. Claude Code hängt <code>/v1/messages</code> selbst an. Wer <code>/v1</code> in die Base-URL schreibt, landet bei <code>/v1/v1/messages</code> und bekommt 404.</p>
<p><strong>Codex CLI</strong> spricht OpenAI Responses. In <code>~/.codex/config.toml</code>:</p>
<pre><code class="language-toml">model_provider = "qcode"
model = "gpt-6.2-sol"

[model_providers.qcode]
name = "qcode"
base_url = "https://api.qcode.cc/openai"
wire_api = "responses"
requires_openai_auth = true
</code></pre>
<p>Dazu <code>~/.codex/auth.json</code> mit <code>{ "OPENAI_API_KEY": "cr_dein_key" }</code>. Mit <code>requires_openai_auth = true</code> ignoriert Codex <code>env_key</code>. Codex hängt <code>/responses</code> an die <code>base_url</code> an.</p>
<p>Das ist eine Protokollgrenze, kein Konfigurationsfehler: Claude-Modelle laufen nur über den Anthropic-Pfad, GPT-Modelle nur über den OpenAI-Pfad. GLM, Kimi, DeepSeek und Qwen laufen über beide. Details stehen in der deutschen Doku: <a href="https://docs.qcode.cc/de/docs/getting-started/endpoints-and-api-paths">Endpunkte und API-Pfade</a> und <a href="https://docs.qcode.cc/de/docs/getting-started/codex-quick-start">Codex-Schnellstart</a>.</p>
<h2>2. Fünf Messungen, die für jeden Relay gelten, auch für unseren</h2>
<p>Ich habe zwei Python-Skripte geschrieben, die nur die Standardbibliothek brauchen (MIT): <a href="https://github.com/ethan-cur/llm-endpoint-check">llm-endpoint-check</a> und <a href="https://github.com/ethan-cur/llm-relay-bench">llm-relay-bench</a>. Beide lesen den Key aus einer Umgebungsvariable und geben ihn nie aus.</p>
<h3>a) Gibt es die Route, und antwortet sie wie eine API?</h3>
<pre><code class="language-bash">curl -fsSLO https://raw.githubusercontent.com/ethan-cur/llm-endpoint-check/main/llm_endpoint_check.py
python3 llm_endpoint_check.py --no-key --openai https://DEIN-RELAY/v1
export LLM_API_KEY=absichtlich_falsch
python3 llm_endpoint_check.py --anthropic https://DEIN-RELAY --responses https://DEIN-RELAY/v1
</code></pre>
<p>Eine saubere API antwortet auf einen falschen Key mit <strong>401 und JSON-Body</strong>. Eine HTML-Seite mit Status 200, ein Redirect oder eine Cloudflare-Challenge heißt: Dieser Endpunkt ist nicht für programmatische Clients gebaut, und die Fehlermeldungen der SDKs werden unverständlich.</p>
<p>Ehrliches Ergebnis gegen unseren eigenen Dienst am 2. Dezember 2026: <code>GET /openai/v1/models</code> ohne Key liefert 401 JSON, ein ungültiger Key bekommt auf den POST-Routen 401 JSON. Ein POST <strong>ganz ohne Auth-Header</strong> lieferte dagegen eine HTML-Seite mit 200. Genau solche Ecken soll dieser Test finden.</p>
<h3>b) Time to first token statt „Ping“</h3>
<pre><code class="language-bash">curl -fsSLO https://raw.githubusercontent.com/ethan-cur/llm-relay-bench/main/relay_bench.py
export LLM_API_KEY=dein_echter_key
python3 relay_bench.py --anthropic https://DEIN-RELAY --anthropic-model claude-sonnet-5-5 \
  --runs 10 --label "Berlin, Glasfaser" --out ergebnis.json
</code></pre>
<p>Das Skript schickt kleine gestreamte Anfragen mit <code>max_tokens</code> 16 und einer zufälligen Nonce, damit kein Response-Cache greift. Berichte <strong>Median und p90</strong>, nie den besten Lauf, und schreib dazu, von wo du gemessen hast. Die Latenz zu einem Relay ist vor allem Geografie. Bei Reasoning-Modellen zählt das erste Reasoning- oder Tool-Delta als erstes Token.</p>
<h3>c) Fehler neben der Latenz zählen</h3>
<p>Ein Relay, der in einer Sekunde antwortet, aber jede fünfte Anfrage verliert, ist nicht schnell: Der Agent wiederholt die Anfrage, und du wartest trotzdem. Transportfehler (TLS EOF, Resets) haben keinen HTTP-Status, und viele Dashboards lassen sie stillschweigend weg.</p>
<h3>d) Prompt-Caching prüfen und <code>usage</code> richtig lesen</h3>
<p>Schick denselben langen Prefix (über etwa 1.024 Tokens) zweimal mit <code>cache_control: {"type": "ephemeral"}</code>. Beim zweiten Aufruf muss <code>usage.cache_read_input_tokens</code> größer als null sein (<a href="https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching">Anthropic-Doku zu Prompt Caching</a>). Die Falle: Mit Cache zählt <code>input_tokens</code> nur den <strong>nicht</strong> gecachten Teil. Die echte Prompt-Größe ist</p>
<pre><code>input_tokens + cache_creation_input_tokens + cache_read_input_tokens
</code></pre>
<p>und diese Summe sollte bei zwei identischen Aufrufen gleich bleiben. Wer nur <code>input_tokens</code> mit der Prompt-Länge vergleicht, beschuldigt ehrliche Anbieter zu Unrecht.</p>
<h3>e) „Echtes Modell?“ – Signale, keine Beweise</h3>
<p>Ob das <code>model</code>-Feld zur Anfrage passt, ob Caching mit Cache-Read-Abrechnung, Tool-Use und Extended Thinking sich wie beim Originalanbieter verhalten, ob die Token-Zahlen stabil sind: Das sind gute Signale, aber keines davon beweist etwas. Ein entschlossener Betrüger kann ein <code>model</code>-Feld fälschen. Was hilft: dieselben Messungen regelmäßig von mehreren Orten laufen lassen und die Rohdaten veröffentlichen.</p>
<h2>3. Fakten zu qcode.cc (Stand 2. Dezember 2026)</h2>
<ul>
<li>Preis = Listenpreis von Anthropic/OpenAI × Servicerate. Die <a href="https://qcode.cc/de/models">Modellseite</a> zeigt heute <strong>×1.0</strong> für Claude und für OpenAI. Chinesische Modelle haben keine angezeigte Rate. Raten können sich ändern, also schau in die Zeile deines Modells.</li>
<li>30-Tage-Pläne mit Tageskontingent in US-Dollar ab <strong>$9 für $5/Tag</strong>, 7-Tage-Pakete ab <strong>$4 mit $30 Kontingent</strong>. Das Kontingent wird also zu Listenpreisen abgerechnet, aber unter Nennwert verkauft. Einen Gratis-Plan gibt es nicht. <a href="https://qcode.cc/de/pricing">Preise</a>.</li>
<li>Zahlung: Karte (Visa/Mastercard), Apple Pay / Google Pay, Alipay, WeChat Pay und Kryptowährungen.</li>
<li>Anthropic veröffentlicht, in welchen Ländern und Regionen der Dienst angeboten wird: <a href="https://www.anthropic.com/supported-countries">https://www.anthropic.com/supported-countries</a>. Prüf das für deinen Standort.</li>
</ul>
<p>Fragen und Korrekturen gerne in den Kommentaren oder an <a href="mailto:hi@qcode.cc">hi@qcode.cc</a>. Wer die Skripte gegen irgendeinen Relay laufen lässt: Pull Requests mit den rohen JSON-Ergebnissen sind willkommen. Bitte angeben, wenn du für den getesteten Relay arbeitest.</p>
]]></content:encoded></item><item><title><![CDATA[Claude Code dan Codex CLI dengan Base URL pihak ketiga: konfigurasi dan 5 cara menguji relay]]></title><description><![CDATA[Memakai Claude Code dan Codex CLI lewat pihak ketiga cukup mengganti Base URL dan API key. Yang sulit: memastikan perantaranya jujur.]]></description><link>https://qcodenotes.hashnode.dev/claude-code-dan-codex-cli-dengan-base-url-pihak-ketiga-konfigurasi-dan-5-cara-menguji-relay</link><guid isPermaLink="true">https://qcodenotes.hashnode.dev/claude-code-dan-codex-cli-dengan-base-url-pihak-ketiga-konfigurasi-dan-5-cara-menguji-relay</guid><category><![CDATA[claude-code]]></category><category><![CDATA[codex]]></category><category><![CDATA[llm]]></category><category><![CDATA[api]]></category><category><![CDATA[indonesia]]></category><dc:creator><![CDATA[QCode]]></dc:creator><pubDate>Tue, 01 Dec 2026 16:25:01 GMT</pubDate><content:encoded><![CDATA[<p><em>Pengungkapan: saya mengelola <a href="https://qcode.cc">qcode.cc</a>, sebuah layanan API independen (tidak berafiliasi dengan Anthropic maupun OpenAI). Artikel ini ditulis dengan bantuan AI; perintah dan angka di dalamnya saya cek ke halaman aslinya pada 1 Desember 2026.</em></p>
<p>Claude Code memakai protokol <strong>Anthropic Messages</strong>, sedangkan Codex CLI memakai <strong>OpenAI Responses</strong>. Kalau ingin memakai keduanya lewat penyedia pihak ketiga (relay, gateway sendiri, atau layanan seperti milik kami), yang perlu diganti cuma dua: <strong>Base URL</strong> dan <strong>API key</strong>. Mengaturnya mudah. Yang sulit adalah memastikan perantaranya jujur, jadi separuh artikel ini membahas cara mengukur.</p>
<h2>1. Claude Code: <code>ANTHROPIC_BASE_URL</code></h2>
<pre><code class="language-bash">export ANTHROPIC_BASE_URL=https://api.qcode.cc/api
export ANTHROPIC_AUTH_TOKEN=cr_key_anda
claude
</code></pre>
<p>Agar tidak perlu <code>export</code> di setiap terminal, simpan di <code>~/.claude/settings.json</code>:</p>
<pre><code class="language-json">{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.qcode.cc/api",
    "ANTHROPIC_AUTH_TOKEN": "cr_key_anda"
  }
}
</code></pre>
<p>Claude Code menambahkan <code>/v1/messages</code> sendiri, sehingga request dikirim ke <code>https://api.qcode.cc/api/v1/messages</code>. Kesalahan yang sering terjadi: menambahkan <code>/v1</code> di Base URL, lalu jadi <code>/v1/v1/messages</code> dan dapat 404.</p>
<p>Tutorial lengkap berbahasa Indonesia (dengan skrip instalasi): <a href="https://docs.qcode.cc/id/docs/getting-started/claude-code-tutorial">Tutorial Claude Code</a>.</p>
<h2>2. Codex CLI: <code>config.toml</code> + <code>auth.json</code></h2>
<p><code>~/.codex/config.toml</code>:</p>
<pre><code class="language-toml">model_provider = "qcode"
model = "gpt-6.2-sol"

[model_providers.qcode]
name = "qcode"
base_url = "https://api.qcode.cc/openai"
wire_api = "responses"
requires_openai_auth = true
</code></pre>
<p><code>~/.codex/auth.json</code>:</p>
<pre><code class="language-json">{ "OPENAI_API_KEY": "cr_key_anda" }
</code></pre>
<p>Dengan <code>requires_openai_auth = true</code>, Codex membaca key dari <code>auth.json</code> dan mengabaikan <code>env_key</code>. Codex menambahkan <code>/responses</code> ke <code>base_url</code>, jadi request dikirim ke <code>/openai/responses</code>. Panduan: <a href="https://docs.qcode.cc/id/docs/getting-started/codex-quick-start">Mulai cepat Codex CLI</a>.</p>
<p>SDK dan klien yang kompatibel dengan OpenAI (Cursor, Cline, SDK Python) memakai <code>https://api.qcode.cc/openai/v1</code>.</p>
<p><strong>Ini batas protokol, bukan salah konfigurasi:</strong> model Claude hanya jalan lewat jalur Anthropic, dan model GPT hanya lewat jalur OpenAI. GLM, Kimi, DeepSeek, dan Qwen bisa lewat keduanya. Tabel lengkapnya ada di <a href="https://docs.qcode.cc/id/docs/getting-started/endpoints-and-api-paths">Endpoint dan path API</a>.</p>
<h2>3. Sebelum percaya: 5 tes yang bisa Anda ulangi sendiri</h2>
<p>Tes ini berlaku untuk relay <strong>mana pun</strong>, termasuk milik kami. Saya menulis dua skrip Python yang hanya memakai standard library (MIT): <a href="https://github.com/ethan-cur/llm-endpoint-check">llm-endpoint-check</a> dan <a href="https://github.com/ethan-cur/llm-relay-bench">llm-relay-bench</a>. Keduanya membaca key dari environment variable dan tidak pernah mencetaknya.</p>
<p><strong>a) Apakah route-nya ada dan menjawab seperti API?</strong></p>
<pre><code class="language-bash">curl -fsSLO https://raw.githubusercontent.com/ethan-cur/llm-endpoint-check/main/llm_endpoint_check.py
python3 llm_endpoint_check.py --no-key --openai https://RELAY-ANDA/v1
export LLM_API_KEY=key_salah_sengaja
python3 llm_endpoint_check.py --anthropic https://RELAY-ANDA --responses https://RELAY-ANDA/v1
</code></pre>
<p>Untuk key yang salah, API yang baik membalas <strong>401 dengan body JSON</strong>. Kalau yang datang halaman HTML dengan status 200, redirect, atau tantangan Cloudflare, endpoint itu tidak dibuat untuk klien program, dan hasilnya pesan error SDK jadi membingungkan.</p>
<p>Hasil jujur terhadap layanan kami sendiri pada 1 Desember 2026: <code>GET /openai/v1/models</code> tanpa key menghasilkan 401 JSON, dan key yang salah menghasilkan 401 JSON di route POST. Tapi POST <strong>tanpa header autentikasi sama sekali</strong> malah mengembalikan halaman HTML dengan status 200. Kekurangan seperti inilah yang memang ingin ditemukan oleh tes ini.</p>
<p><strong>b) Ukur waktu sampai token pertama (TTFT), bukan "ping".</strong></p>
<pre><code class="language-bash">curl -fsSLO https://raw.githubusercontent.com/ethan-cur/llm-relay-bench/main/relay_bench.py
export LLM_API_KEY=key_asli_anda
python3 relay_bench.py --anthropic https://RELAY-ANDA --anthropic-model claude-sonnet-5-5 \
  --runs 10 --label "Jakarta, fiber rumah" --out hasil.json
</code></pre>
<p>Skrip mengirim request kecil secara streaming dengan nonce acak. Laporkan <strong>median dan p90</strong>, jangan hasil terbaik, dan catat dari mana Anda mengukur. Latensi ke relay sebagian besar ditentukan oleh geografi.</p>
<p><strong>c) Hitung error di samping latensi.</strong> Relay yang menjawab dalam 1 detik tapi gagal 1 dari 5 kali tidak bisa disebut cepat. Error transport (TLS EOF, reset) tidak punya kode HTTP, dan banyak dashboard diam-diam membuangnya.</p>
<p><strong>d) Cek prompt caching.</strong> Kirim prefix panjang yang sama (lebih dari ~1.024 token) dua kali dengan <code>cache_control</code>. Pada panggilan kedua, <code>usage.cache_read_input_tokens</code> harus lebih dari nol. Jebakannya: saat cache aktif, <code>input_tokens</code> hanya menghitung bagian yang <strong>tidak</strong> di-cache. Ukuran prompt sebenarnya adalah <code>input_tokens + cache_creation_input_tokens + cache_read_input_tokens</code>.</p>
<p><strong>e) "Keaslian model" hanyalah sinyal, bukan bukti.</strong> Field <code>model</code> yang cocok, caching dan tool use yang berperilaku seperti di penyedia asli, dan jumlah token yang stabil adalah sinyal yang baik. Tapi tidak satu pun yang membuktikan apa-apa sendirian. Waspadai siapa pun yang bilang satu tes bisa "membuktikan" keaslian model.</p>
<h2>4. Fakta qcode.cc (dicek 1 Desember 2026)</h2>
<ul>
<li>Harga = harga daftar Anthropic/OpenAI × tarif layanan. <a href="https://qcode.cc/id/models">Halaman model</a> hari ini menampilkan <strong>×1.0</strong> untuk Claude dan OpenAI. Model Tiongkok tidak menampilkan tarif. Tarif bisa berubah, jadi cek baris model Anda.</li>
<li>Paket personal 30 hari dengan kuota harian dalam dolar, mulai <strong>$9 untuk $5/hari</strong>. Paket 7 hari mulai <strong>$4 dengan kuota $30</strong>. Artinya kuota dihitung dengan harga daftar, tapi dijual di bawah nilai nominalnya. Tidak ada paket gratis. <a href="https://qcode.cc/id/pricing">Harga</a>.</li>
<li>Pembayaran: kartu (Visa/Mastercard), Apple Pay / Google Pay, Alipay, WeChat Pay, dan kripto.</li>
<li>Anthropic menerbitkan daftar negara dan wilayah yang mereka layani: <a href="https://www.anthropic.com/supported-countries">https://www.anthropic.com/supported-countries</a>. Silakan cek untuk lokasi Anda.</li>
</ul>
<p>Pertanyaan dan koreksi: lewat komentar atau <a href="mailto:hi@qcode.cc">hi@qcode.cc</a>. Kalau Anda menjalankan skrip ini ke relay mana pun, PR berisi JSON mentahnya sangat diterima (sebutkan kalau Anda bekerja untuk relay yang diuji).</p>
]]></content:encoded></item><item><title><![CDATA[Is your LLM API relay honest? Five things you can measure yourself in 10 minutes]]></title><description><![CDATA[Run an API relay integrity test in 10 minutes: TTFT, errors, JSON 401s, prompt-cache usage, and model signals on a third-party Claude/Codex base URL.]]></description><link>https://qcodenotes.hashnode.dev/llm-api-relay-integrity-test</link><guid isPermaLink="true">https://qcodenotes.hashnode.dev/llm-api-relay-integrity-test</guid><category><![CDATA[llm]]></category><category><![CDATA[api]]></category><category><![CDATA[claude-code]]></category><category><![CDATA[#anthropic]]></category><category><![CDATA[openai]]></category><category><![CDATA[codex]]></category><category><![CDATA[prompt caching]]></category><dc:creator><![CDATA[QCode]]></dc:creator><pubDate>Sun, 29 Nov 2026 22:01:04 GMT</pubDate><content:encoded><![CDATA[<p><em>Disclosure: I work on <a href="https://qcode.cc">qcode.cc</a>, an API relay for Claude Code and Codex CLI. Everything below works against any relay, including ours, and the script is MIT-licensed.</em></p>
<p>If you use Claude Code, Codex CLI, or an OpenAI SDK through a third-party API — after setting <code>ANTHROPIC_BASE_URL</code>, a custom Codex <code>base_url</code>, or a "configure third-party inference" endpoint — you are trusting a middleman with three things: your latency, your bill, and the claim that the model you asked for is the model you got. Most relays answer all three with adjectives ("fast", "stable", "official"). Here is an API relay integrity test that replaces the adjectives with numbers you can rerun yourself.</p>
<h2>1. Measure time to first token, not "ping"</h2>
<p>What you feel in Claude Code is <strong>time to first token (TTFT)</strong> on a streamed request, not ICMP ping and not total request time. Measure it on a tiny, fixed task so model speed does not drown the network signal:</p>
<ul>
<li>stream on, <code>max_tokens</code> 16, prompt "Reply with exactly: pong"</li>
<li>a random nonce in every prompt, so nothing comes from a response cache</li>
<li>at least 5 runs; report <strong>median and p90</strong>, never the best run</li>
<li>write down where you tested from. Latency to a relay is mostly geography.</li>
</ul>
<p>Reasoning models stream reasoning deltas before visible text. Count the first reasoning or tool delta as the first token, or every reasoning model will look broken.</p>
<h2>2. Count errors next to latency</h2>
<p>A relay that answers in 1 second but fails one request in five is not fast; your agent will retry and you will wait anyway. Record the HTTP status of every run. Also watch for transport errors (TLS EOF, resets): they do not show up as a status code at all, and many dashboards silently drop them.</p>
<h2>3. Check that a bad key gets a JSON 401</h2>
<p>Send a request with a deliberately invalid key. A well-behaved API returns <strong>401 or 403 with a JSON error body</strong>. A 200 HTML landing page, a redirect, or a Cloudflare challenge tells you the endpoint was not built for programmatic clients, and it is exactly what breaks automated probes and confuses SDK error messages.</p>
<h2>4. Verify prompt caching actually works, and read usage correctly</h2>
<p>Prompt caching is where long Claude Code sessions save most of their money, so it is worth checking. Send the same long system prefix (over about 1,024 tokens) with <code>cache_control: {"type": "ephemeral"}</code> twice. On the second call, <code>usage.cache_read_input_tokens</code> should be greater than zero. Anthropic's own <a href="https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching">prompt caching docs</a> describe the same <code>cache_control</code> field.</p>
<p>The trap: with caching on, <code>input_tokens</code> only counts the <strong>uncached</strong> part of the prompt. In one of my test runs the prompt was 2,785 tokens in total, and the second call reported <code>cache_read_input_tokens: 2560</code>, so <code>input_tokens</code> alone looked tiny. If you (or a leaderboard) compare <code>input_tokens</code> against the prompt length, you will accuse honest providers of under- or over-counting. The real prompt size is:</p>
<pre><code>input_tokens + cache_creation_input_tokens + cache_read_input_tokens
</code></pre>
<p>That sum should be stable across two identical calls.</p>
<h2>5. Treat "model authenticity" as signals, not proof</h2>
<p>People rightly worry about relays quietly serving a cheaper model. Things you can check:</p>
<ul>
<li>the <code>model</code> field in the response echoes what you requested;</li>
<li>features that only the real upstream supports behave correctly: prompt caching with cache-read accounting, tool use, extended thinking where the model supports it;</li>
<li>token counts for the same text are stable across calls.</li>
</ul>
<p>None of these is proof. A determined cheater can fake a <code>model</code> field. Be suspicious of anyone, relay or tester, who says one test "proves" authenticity. What you can do is make cheating detectable over time: run the same probes regularly from more than one place and publish the raw results.</p>
<h2>The script</h2>
<p>I put the method into one standard-library Python file: <a href="https://github.com/ethan-cur/llm-relay-bench">llm-relay-bench</a>. It tests Anthropic Messages (Claude Code), OpenAI Chat Completions, and OpenAI Responses (Codex CLI), reads the key from an environment variable, never writes it to the report, and outputs JSON you can diff or publish.</p>
<pre><code class="language-bash">curl -fsSLO https://raw.githubusercontent.com/ethan-cur/llm-relay-bench/main/relay_bench.py
export LLM_API_KEY=...            # read from the environment, never printed or saved

# Claude Code style endpoint (ANTHROPIC_BASE_URL)
python3 relay_bench.py --anthropic https://relay.example.com --anthropic-model &lt;claude-model-id&gt; \
                       --runs 10 --label "Berlin, home fiber" --out result.json

# OpenAI-compatible + Codex Responses
python3 relay_bench.py --openai https://relay.example.com/v1 --openai-model &lt;model-id&gt; \
                       --responses https://relay.example.com/v1 --responses-model &lt;model-id&gt;
</code></pre>
<p>Useful options: <code>--auth x-api-key</code> for Anthropic's header style, <code>--pause</code> seconds between runs (default 6, to stay under a typical 10 requests/minute cap), <code>--key-env MY_VAR</code> if you do not want to use <code>LLM_API_KEY</code>.</p>
<p>If you run it against any relay, ours included, pull requests with raw JSON results are welcome. Please say if you work for the relay you tested.</p>
<p>If your relay "does not work" at all, start one step earlier with <a href="https://github.com/ethan-cur/llm-endpoint-check">llm-endpoint-check</a>, which explains 404 vs 401 vs "HTML instead of JSON" for a given Base URL.</p>
<p><em>Contact: <a href="mailto:hi@qcode.cc">hi@qcode.cc</a></em></p>
]]></content:encoded></item><item><title><![CDATA[Daily quota vs 7-day token packs: pointing Claude Code and Codex at a third-party base URL]]></title><description><![CDATA[Disclosure: I work on and operate qcode.cc. This is a practical note about how we bill and how to point two common coding CLIs at the service, not a…]]></description><link>https://qcodenotes.hashnode.dev/daily-quota-vs-7-day-token-packs-pointing-claude-code-and-codex-at-a-third-party-base-url</link><guid isPermaLink="true">https://qcodenotes.hashnode.dev/daily-quota-vs-7-day-token-packs-pointing-claude-code-and-codex-at-a-third-party-base-url</guid><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[claude]]></category><category><![CDATA[openai]]></category><category><![CDATA[Developer Tools]]></category><dc:creator><![CDATA[QCode]]></dc:creator><pubDate>Thu, 26 Nov 2026 02:25:39 GMT</pubDate><content:encoded><![CDATA[<p>Disclosure: I work on and operate <a href="https://qcode.cc">qcode.cc</a>. This is a practical note about how we bill and how to point two common coding CLIs at the service, not a review.</p>
<p>A recurring question I get is whether to buy a monthly plan or a short token pack when using AI coding tools through a third-party API. The short version: if you work most days, a daily-quota plan is simpler; if you only need a burst, a 7-day pack is enough. The details are in <a href="https://docs.qcode.cc/en/docs/getting-started/choose-a-plan">Choose a plan</a>.</p>
<h2>How billing is structured</h2>
<p>We charge at the official API price × 1.0 (the current multiplier for Anthropic and OpenAI models is 1.0). Prompt cache reads are about 10% of the input price, which matters on long sessions.</p>
<p>Personal plans last 30 days. The quota is a daily dollar amount that resets at midnight Beijing time. The entry plan is $9 for 30 days with a $5/day quota (5 concurrent requests per key). Larger daily amounts go up through $10, $20, $35, $50 and $85 per day; there is also an “Ultimate” plan at $252.57 / 30 days with no daily cap and a $4,000 monthly allowance (10 concurrent requests). Multi-month prepayment is 10% off for 3 months, 20% off for 6 months, and 25% off for 12 months (pay for 9, get 3). These are paid up front and do not auto-renew. If you upgrade, unused value from the old plan is credited proportionally.</p>
<p>Token packs do not require a subscription. They last 7 days, start at $4 for $30 of usage, and can be stacked (allowance adds up, expiry extends). They suit a short project.</p>
<p>Team plans start at $257 / month per unit ($4,000 monthly allowance and 35 concurrency per unit), with a separate admin console and sub-keys.</p>
<p>Payment methods we officially list: Alipay, WeChat Pay, Visa/Mastercard, Apple Pay, Google Pay, and cryptocurrency (9 coins, 56 networks). Invoices are available. Prices are shown in USD and CNY.</p>
<h2>Pointing the tools at the right protocol</h2>
<p>The same key is valid on both protocols; the path chooses the protocol. Claude models only work on the Anthropic Messages path; GPT models only work on the OpenAI path.</p>
<pre><code class="language-bash"># Claude Code
export ANTHROPIC_BASE_URL=https://api.qcode.cc/api
export ANTHROPIC_AUTH_TOKEN=cr_your_key
</code></pre>
<pre><code class="language-toml"># ~/.codex/config.toml — Codex CLI, Responses API
model_provider = "qcode"
model = "gpt-6.2-sol"

[model_providers.qcode]
name = "qcode"
base_url = "https://api.qcode.cc/openai"
wire_api = "responses"
requires_openai_auth = true
</code></pre>
<p>If you want a regional endpoint instead of global routing, use <code>asia.qcode.cc</code> or <code>us.qcode.cc</code> with the same paths. See <a href="https://docs.qcode.cc/en/docs/getting-started/endpoints-and-api-paths">Endpoints and API paths</a>. A step-by-step Claude Code install, including the one-line script, is in the <a href="https://docs.qcode.cc/en/docs/getting-started/claude-code-tutorial">Claude Code tutorial</a>.</p>
<h2>Limits worth knowing</h2>
<ul>
<li>There is no 4-hour rolling window on personal plans; you only have the daily quota (or the pack balance).</li>
<li>If an upstream account is banned, we replace it; you do not have to do anything.</li>
<li>Support is staffed 10:00–22:00 Beijing time, usually within one to two hours.</li>
<li>The forwarding layer does not store request content.</li>
<li>We are an online team, not a registered company.</li>
</ul>
<p>I will answer setup questions in the comments. If you want a walk-through for a specific editor (Cursor, Cline, JetBrains, and others), the index is at <a href="https://docs.qcode.cc/en/docs">docs.qcode.cc</a>.</p>
]]></content:encoded></item></channel></rss>