Skip to content

Claude Code gets 429 while /v1/messages and /v1/chat/completions return 200 via playground #181

Closed

Description

@thepc950-prog

Summary

Claude Code consistently returns 429 Free usage limit reached when routed through opencode2api to OpenCode free models. However, the same proxy returns 200 for:

  • /v1/chat/completions via the playground
  • /v1/messages via the playground / diagnostic test

This suggests the proxy and WARP egress are healthy, but Claude Code’s request shape is being rejected upstream.

Environment

  • OS: Windows 10/11
  • opencode2api version: dev (from startup log)
  • opencode2api address: http://localhost:8080
  • WebUI: http://localhost:8081
  • Claude Code version: v2.1.325
  • Model: deepseek-v4.1-flash-free[1m]
  • Auth: local token / anonymous Zen tier
  • WARP: enabled, IPv6 egress rotation active

Steps to reproduce

  1. Start opencode2api with config.json.
  2. Configure Claude Code to use:
    • ANTHROPIC_BASE_URL=http://localhost:8080
    • ANTHROPIC_AUTH_TOKEN=sk-local-...
    • model deepseek-v4.1-flash-free[1m]
  3. Open Claude Code and send a simple prompt: hii.
  4. Observe 429 in Claude Code.
  5. In the opencode2api WebUI, run a diagnostic/playground request against the same model.
  6. Observe 200 with a valid response.

Expected behavior

Claude Code should receive a 200 response, the same as the playground/diagnostic request.

Actual behavior

Claude Code returns:

API Error: Request rejected (429) · Free usage limit reached.
Free models work in OpenCode (https://opencode.ai); subscribe to OpenCode Go to keep going.


Proxy log for the Claude Code request:

{"level":"INFO","msg":"request routed","method":"POST","path":"/v1/messages","status":429,"model":"deepseek-v4.1-flash-free","tier":"zen","attempts":5,"legs":"anon:429:3148ms@warp:... anon:429:2879ms@warp:... 3yUBQ:429:3825ms 3yUBQ:429:4117ms 3yUBQ:429:3892ms","outcome":"client_error"}


Proxy log for a successful playground request on the same WARP pool:

{"level":"INFO","msg":"request routed","method":"POST","path":"/v1/chat/completions","status":200,"model":"deepseek-v4.1-flash-free","tier":"zen","key_id":"anonymous","channel":"anonymous","attempts":1,"legs":"anon:200:2487ms@warp:...","outcome":"success"}

Activity

  1. jasonxu114514 commented on Nov 16, 2026

    @jasonxu114514
    Owner

    Main 14faec7 preserves the latest upstream HTTP error and Retry-After across later transport failures, fixes title classification before shaping, legacy tool renaming and Responses assistant turns. Optional prompt_environment retains existing defaults. Offline regressions, vet, Windows/Linux builds and WebUI checks passed. No live model request was made, so this does not prove the reported Claude Code 429 is resolved; keeping this issue open. Please retest an updated binary and report its commit plus a minimal sanitized reproduction if still failing. Never include credentials, authorization headers or private prompts. Related #178 and #180. Commit: 14faec7

  2. unrayed commented on Nov 16, 2026

    @unrayed
    Contributor

    Root cause found, and it is not the session or the egress: the free tier refuses the literal clint_ that the gateway puts in front of every renamed client tool. Fixed in #182.

    Reproduced on your path. Anthropic-shaped /v1/messages request with Claude Code's tool vocabulary (9 tools, Bash/Read/Edit/…, stream: true), replayed against two builds of 14faec7 that differ only in ClientToolPrefix:

    build result
    clint_ 429 in 2.4 s
    mcp_ 200 in 2.2 s, tool_use block restored to Bash

    Same on the official CLI's 20-tool chat body (75,654 B, max_completion_tokens: 32000):

    build result
    clint_ 429 in 3.4 s
    mcp_ 200 in 2.6 s, tool call restored to shell; follow-up carrying the tool result 200 with the final answer

    What the gate actually matches, one identical body, same session id, same project id, same egress:

    wire-name prefix result
    clint_ 429
    CLINT_ 429
    clint (no underscore) 200
    client_, copilot_, mcp_, srv_, fn_, zz_ 200
    client names passed through unrenamed 200
    shaping bypassed entirely 200
    prompt injection only, tools untouched 200

    So the rename itself is still accepted and another client's vocabulary is still refused — the clint_ token became a marker, case-insensitive, trailing underscore required.

    That also rules out the alternatives: the session id, project id and egress were identical in the 429 and the 200 runs, so re-minting (#175) and per-egress quota accounting (#172) do not explain your report.

    Retest: PR #182, head 75bb45d, branch fix/free-tier-wire-name-prefix. A commit hash plus a minimal sanitized reproduction is all that is needed — no credentials, authorization headers or private prompts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions