logoalt Hacker News

orliesaurusyesterday at 10:55 PM7 repliesview on HN

Is there a way to do this directly by using claudecode CLI (which I already have installed) and openrouter??


Replies

jubilantitoday at 12:18 AM

Here's a oneliner:

   ANTHROPIC_BASE_URL="https://openrouter.ai/api" ANTHROPIC_AUTH_TOKEN="$OPENROUTER_API_KEY" ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek/deepseek-v4-flash" CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 claude
theanonymousoneyesterday at 10:58 PM

Yes, from Claude Code themselves: https://code.claude.com/docs/en/llm-gateway

gnatyesterday at 10:58 PM

This repo's README explains how it works and you can do it yourself. claude looks for environment variables that say which API endpoint to talk to, which key to pass, which model name to use for haiku/sonnet/opus-level workloads, etc.