Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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



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


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


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.


Been using Claude as a harness to OpenRouter for a while now. It's a nice setup if you don't mind API based billing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: