molecule-ai-workspace-templ.../tests
Hongming Wang c1fc78090e
Some checks failed
CI / validate (push) Failing after 0s
fix(adapter): route anthropic:/claude: prefixes via OpenRouter, not OpenAI
OpenClaw is OpenAI-compat only (--custom-compatibility openai is
hard-set). Prior routing fell through every unrecognised prefix
(including anthropic and claude) to OPENAI_API_KEY + api.openai.com
with the bare model id, so workspaces booted with the wheel-default
`anthropic:claude-opus-4-7` reached `running` status while every
inference call returned 401/404 from OpenAI.

Detect anthropic/claude → re-route through OpenRouter at slash-form
`anthropic/<id>`, which exposes Claude under the OpenAI-compat API.
Per-prefix API-key lookup also lands so groq/openrouter/qianfan use
their proper env vars instead of the legacy OPENAI_API_KEY fallthrough.

Routing extracted to a pure helper `_resolve_provider_routing(model,
env, runtime_config)` so the twelve branches it encodes are pinned in
tests/test_model_routing.py without invoking the npm install +
onboard side effects of setup() (which is `# pragma: no cover`).

Filed as Issue 5 in known-issues.md (OWC-272).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 17:20:26 -07:00
..
pytest.ini fix(adapter): route anthropic:/claude: prefixes via OpenRouter, not OpenAI 2026-05-01 17:20:26 -07:00
test_model_routing.py fix(adapter): route anthropic:/claude: prefixes via OpenRouter, not OpenAI 2026-05-01 17:20:26 -07:00