Skip to content

feat: add OrcaRouter as a named alternative API provider - #239

Open
XiaoHuo888-hue wants to merge 1 commit into
AutoForgeAI:masterfrom
XiaoHuo888-hue:add-orcarouter-provider
Open

feat: add OrcaRouter as a named alternative API provider#239
XiaoHuo888-hue wants to merge 1 commit into
AutoForgeAI:masterfrom
XiaoHuo888-hue:add-orcarouter-provider

Conversation

@XiaoHuo888-hue

Copy link
Copy Markdown

Summary

Add OrcaRouter as a named alternative API provider in AutoForge's Settings UI, mirroring the existing GLM/Kimi wiring for Anthropic-compatible providers.

OrcaRouter is an OpenAI/Anthropic-compatible model gateway that routes to Claude and other models through a single endpoint. It also runs gateway-level, zero-trust security for AI agents on the same endpoint — screening every prompt/response and governing every tool call on a default-deny basis, with no application code changes.

Changes

  • registry.py: Add an orcarouter entry to API_PROVIDERS:
    • base_url: https://api.orcarouter.ai (client appends /v1/messages, matching the existing GLM base URL convention)
    • auth_env_var: ANTHROPIC_AUTH_TOKEN (key pasted in the Settings UI is written to the SDK env)
    • Models: anthropic/claude-opus-5, anthropic/claude-sonnet-5, anthropic/claude-haiku-4.5 (the anthropic/ prefix is required by the gateway)
  • Settings UI (SettingsModal.tsx, SettingsView.tsx): OrcaRouter provider chip + description; API key field appears automatically via the existing requires_auth flow.
  • Top-bar badge (ControlBar.tsx): show an OrcaRouter badge when selected, mirroring the GLM badge.
  • server/schemas.py / server/routers/settings.py / ui/src/lib/types.ts / ui/src/hooks/useProjects.ts: plumb orcarouter_mode alongside glm_mode / ollama_mode.
  • Docs: README.md, CLAUDE.md, .env.example document the new provider.

Verification

  • ruff check clean on changed Python files.
  • mypy: no new errors (12 pre-existing errors unchanged on clean main).
  • python test_security.py: 169 passed; pytest test_client.py test_dependency_resolver.py test_rate_limit_utils.py: 55 passed.
  • UI: npm run lint (0 errors) and npm run build pass.
  • Live-tested: POST https://api.orcarouter.ai/v1/messages with model anthropic/claude-sonnet-5 returns HTTP 200 with a valid Anthropic message response.

Disclosure: I'm an engineer on the OrcaRouter team.

Add OrcaRouter to the API_PROVIDERS registry as a named alternative
provider, mirroring the existing GLM/Kimi Anthropic-compatible wiring:

- registry.py: 'orcarouter' provider entry (base_url
  https://api.orcarouter.ai, auth via ANTHROPIC_AUTH_TOKEN, Claude
  model tiers with anthropic/ prefixes)
- Settings UI: provider chip, description, and top-bar OrcaRouter badge
  when selected (orcarouter_mode)
- README.md / CLAUDE.md / .env.example: document the new provider
- client.py: comment update

Verified: ruff clean, mypy no new errors (12 pre-existing), 169 security
tests + 55 pytest pass, UI lint/build clean, and live-tested the endpoint
POST https://api.orcarouter.ai/v1/messages (200, model claude-sonnet-5).

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: jinhao.song <jinhao.song@myflashcloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant