I want to use openrouter

Status Fixed / completed
Maintainer reply ✓ Yes — catherinewu
Activity 13 comments · opened Feb 24, 2025 · closed Feb 26, 2025
💡 Likely answer: A maintainer (catherinewu, contributor) responded on this thread — see the highlighted reply below.

No description provided.

View original on GitHub ↗

13 Comments

tyler-gametime · 1 year ago

Big +1 to this, until this is supported it will block adaption by my company.

ping-Toven · 1 year ago

Would love to see this :)

fn5 · 1 year ago

Please! Keen as a bean.

catherinewu contributor · 1 year ago

@tyler-gametime and others - could you share more about why you'd like to use claude code via openrouter?

RodolfoCastanheira · 1 year ago

Not exactly this, but for me it would be very useful to be able to change the api address too, so I could appoint it to my litellm instance that logs and normalize my LLM api usage.

mehertz · 1 year ago

Echoing @RodolfoCastanheira's comment - quite surprised that we can't point this at LiteLLM (which is just a Bedrock proxy) so we can get logging, central auth and that sort of stuff. Appreciate it's a research preview though!

Just need to be able to change the base url for bedrock (tbf AWS_ENDPOINT_URL env var might work, haven't tried).

mneuhaus · 1 year ago

so i did a little digging...

here are all Envs i've found in the claude code:

  • CLAUDE_CODE_USE_BEDROCK
  • CLAUDE_CODE_USE_VERTEX
  • ANTHROPIC_MODEL
  • VERTEX_REGION_CLAUDE_3_5_HAIKU
  • VERTEX_REGION_CLAUDE_3_5_SONNET
  • VERTEX_REGION_CLAUDE_3_7_SONNET
  • CLAUDE_CONFIG_DIR
  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_SESSION_TOKEN
  • DISABLE_PROMPT_CACHING
  • API_TIMEOUT_MS
  • CLOUD_ML_REGION
  • ANTHROPIC_BASE_URL
  • ANTHROPIC_API_KEY
  • ANTHROPIC_AUTH_TOKEN
  • ANTHROPIC_BEDROCK_BASE_URL
  • AWS_REGION
  • ANTHROPIC_VERTEX_BASE_URL
  • ANTHROPIC_VERTEX_BASE_URL
  • ANTHROPIC_VERTEX_PROJECT_ID

i managed to get it to connect to LiteLLM with this:

litellm --model openrouter/openai/o3-mini-high --detailed_debug
export ANTHROPIC_BASE_URL=http://0.0.0.0:4000 && export DISABLE_PROMPT_CACHING=0 && claude

it "kinda" works, at least claude seems to send commands and also gets a response, but i guess thats the mode where claude expects a antropic formatted response, and LiteLLM respons in OpenAI format.

FeepingCreature · 1 year ago
@tyler-gametime and others - could you share more about why you'd like to use claude code via openrouter?

I have an OpenRouter account because it used to be impossible to get Anthropic in Germany, and then you refused my credit card lol.

Even that aside, when you often want to compare between models from multiple providers, OpenRouter just takes a whole ton of hassle off the table. It's a pay-as-you-go one-stop shop for everything on one API.

sFritsch09 · 1 year ago

I would like to use Claude via openrouter because we use it in our company and we'd like to keep just one place of AI models for our team.

tyler-gametime · 1 year ago
@tyler-gametime and others - could you share more about why you'd like to use claude code via openrouter?

We're interested in using OpenRouter primarily because of its higher API availability and the enhanced activity tracking along with robust privacy settings. It's already in use by my company as well, so this would enable a seamless integration.

bcherny collaborator · 1 year ago

No plans to enable OpenRouter at this time.

maxnowack · 1 year ago

I wrote a small proxy server that converts the Anthropic API format to an OpenAI-compatible format and forwards it to OpenRouter. You can check it out here: https://github.com/maxnowack/anthropic-proxy.

It kind of works, but it seems that commands are not executed by Claude Code.

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.