proxy --provider openrouter ignores ANTHROPIC_PROXY_BASE_URL (openrouterBaseUrl not passed)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 812
- Forks
- 175
- Avg merge
- 2m
- Merged PRs (30d)
- 3
Description
Summary
agentic-flow proxy --provider openrouter constructs AnthropicToOpenRouterProxy without openrouterBaseUrl, so the standalone proxy can only ever talk to https://openrouter.ai/api/v1. Every other construction site in the package passes it, which makes this look like an omission rather than a decision.
Reproduce
npm i -g agentic-flow@2.1.2
OPENROUTER_API_KEY=placeholder \
ANTHROPIC_PROXY_BASE_URL=http://localhost:11434/v1 \
agentic-flow proxy --provider openrouter --port 3801 --model llama3.2:3b
Actual banner:
OpenRouter Base URL: https://openrouter.ai/api/v1
Expected: http://localhost:11434/v1, i.e. the value of ANTHROPIC_PROXY_BASE_URL, as the other two call sites already honour.
Root cause
Three construction sites, one inconsistent:
| Site | passes openrouterBaseUrl? |
|---|---|
dist/cli-proxy.js:377 (agent path, startOpenRouterProxy) |
yes — process.env.ANTHROPIC_PROXY_BASE_URL |
dist/proxy/anthropic-to-openrouter.js:614 (module entrypoint) |
yes — process.env.ANTHROPIC_PROXY_BASE_URL |
dist/cli-proxy.js:584 (proxy subcommand) |
no |
// dist/cli-proxy.js:583-586
const proxy = new AnthropicToOpenRouterProxy({
openrouterApiKey: apiKey,
defaultModel: finalModel
});
The constructor already defaults to https://openrouter.ai/api/v1 when the field is absent, so passing it through is non-breaking.
Impact
The proxy subcommand is the documented way to put an Anthropic-shaped endpoint in front of Claude Code / Cursor. As written it cannot target a self-hosted or local OpenAI-compatible backend (Ollama, vLLM, LM Studio, LiteLLM, an internal gateway) — which is the main reason to run a local proxy at all. The workaround is to bypass the CLI and run node dist/proxy/anthropic-to-openrouter.js directly, since only its own entrypoint reads the variable.
Suggested fix
const proxy = new AnthropicToOpenRouterProxy({
openrouterApiKey: apiKey,
+ openrouterBaseUrl: process.env.ANTHROPIC_PROXY_BASE_URL,
defaultModel: finalModel
});
Verified locally against 2.1.2: with that one line, the banner reports the local /v1 and requests reach it. Happy to open a PR.
Environment
agentic-flow@2.1.2 · node v22.23.0 · npm 10.9.8 · macOS (Darwin 25.6.0)
Related: #224 (ollama provider — same underlying capability, reached differently)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at dist/cli-proxy.js:584 and compare the proxy subcommand with the other construction sites listed in the issue. Run the provided ANTHROPIC_PROXY_BASE_URL reproduction after the change; done means the banner shows the configured URL and requests reach that endpoint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100