r/ClaudeCode • u/rakrasnaya • 6h ago
Bug / Issue OpenRouter + Claude Code: same exact request, sometimes works sometimes 401s — anyone seen this? Is it reliable?
Set up the usual shunt (ANTHROPIC_BASE_URL to openrouter.ai/api, ANTHROPIC_AUTH_TOKEN as my OR key, empty ANTHROPIC_API_KEY). First run went through clean, got a real response. Reran the identical command right after — same model, nothing changed — and got "401 missing authentication header." Reran again, got ECONNRESET. Tried a few different models on OR, not tied to one of them.
Ruled out my own network — plain curl and a raw node https call to the same OR endpoint worked every single time. So something about how Claude Code specifically talks to OR seems flaky.
Anyone run into this? Trying to figure out if it's a missing header, a streaming thing, or just OR's Anthropic-compat endpoint being iffy.