Skip to content

feat(provider): add AnonRouter - #2328

Merged
zerob13 merged 1 commit into
ThinkInAIXYZ:devfrom
anonrouterai:add-anonrouter-provider
Sep 19, 2026
Merged

zerob13 merged 1 commit into
ThinkInAIXYZ:devfrom
anonrouterai:add-anonrouter-provider

Conversation

@anonrouterai

@anonrouterai anonrouterai commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

I maintain AnonRouter and added it as a disabled built-in provider following DeepChat’s existing OpenAI-compatible provider pattern.

What changed:

  • registers the AnonRouter API base URL and account/documentation links
  • uses the shared API-key, OpenAI-compatible runtime for authenticated model discovery, chat, streaming, tools, and embeddings
  • preserves creator/model IDs returned by the catalog
  • adds the official monochrome provider icon and focused registry/discovery tests

Users need an AnonRouter key with OpenAI-compatible access enabled. No AnonRouter-specific transport was added.

Checks:

  • pnpm run format
  • pnpm run lint
  • pnpm run i18n
  • pnpm run typecheck
  • pnpm exec vitest run test/main/provider/defaultProviders.test.ts test/main/provider/basicApiKeyProviders.test.ts (35 passed)

Summary by CodeRabbit

  • New Features

    • Added AnonRouter as a supported provider for OpenAI-compatible model access.
    • Added provider setup links, including API key, documentation, and model pages.
    • Added AnonRouter branding in the model provider interface.
    • Added authenticated model discovery through AnonRouter’s models endpoint.
  • Tests

    • Added coverage for provider configuration, model discovery, authentication, and model metadata.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 9e5f5035-dba8-4db2-a622-039beaf86e99

📥 Commits

Reviewing files that changed from the base of the PR and between ebfe83a and 293bd6e.

⛔ Files ignored due to path filters (1)
  • src/renderer/src/assets/llm-icons/anonrouter.svg is excluded by !**/*.svg
📒 Files selected for processing (5)
  • src/main/provider/defaults.ts
  • src/main/provider/providerRegistry.ts
  • src/renderer/src/components/icons/modelIconRegistry.ts
  • test/main/provider/basicApiKeyProviders.test.ts
  • test/main/provider/defaultProviders.test.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change adds AnonRouter as a disabled OpenAI-compatible provider with API-key authentication, model discovery, default metadata, renderer icon support, and test coverage.

Changes

AnonRouter provider integration

Layer / File(s) Summary
Provider registration
src/main/provider/defaults.ts, src/main/provider/providerRegistry.ts, test/main/provider/defaultProviders.test.ts
Adds AnonRouter defaults, registry settings, endpoint metadata, and coverage for the disabled provider configuration.
Authenticated model discovery
test/main/provider/basicApiKeyProviders.test.ts
Verifies Bearer authentication, model discovery, nested model identifiers, ownership values, provider identity, and the models endpoint.
Provider icon registration
src/renderer/src/components/icons/modelIconRegistry.ts
Registers the AnonRouter icon and includes it in monochrome icon handling.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: zerob13

Merge Risk: ⚪ Minimal · up to 293bd

The AnonRouter provider integration and icon registration are consistent with their runtime and renderer contracts, with no established merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding AnonRouter as a provider.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 5…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Approve ✅

This PR adds AnonRouter as a disabled-by-default built-in OpenAI-compatible provider. It follows the exact same pattern as recent provider additions (cheaper-inference, RunInfra, Synthorai): a DEFAULT_PROVIDERS entry, an OPENAI_BASE + api-key registry definition, a monochrome icon wired into modelIconRegistry, and two test blocks mirroring the existing ones. 6 files, +118/−1. No over-engineering, no breaking changes, no scope creep.

Verified against the live AnonRouter API

The registry definition matches what AnonRouter's compatibility mode actually exposes:

Capability (per docs.anonrouter.ai/compatibility) PR config OK?
POST /v1/chat/completions (stream + non-stream) openai-completions + OPENAI_BASE
GET /v1/models (bearer call) modelSource: 'openai', checkStrategy: 'fetch-models'
POST /v1/embeddings supported embeddingStrategy: 'openai' (default) ✅ — correct, unlike cheaper-inference/api-route which disable it

Live endpoint checks: POST /v1/chat/completions returns 401 without a key (route exists); GET /v1/models returns 401 authentication_error with an ar_-prefixed key (route exists, auth-gated — an unauthenticated GET falls through to a generic 404, so don't be fooled when testing without a key). All four website URLs (official / api-keys / docs / models) return 200.

Validation run

  • vitest run test/main/provider/basicApiKeyProviders.test.ts test/main/provider/defaultProviders.test.ts → 35/35 pass
  • pnpm run typecheck (node + web) → clean
  • oxfmt --check on the 5 changed TS files → clean
  • anonrouter.svg → valid XML, fill="currentColor" only, correctly added to monoIconUrls

Non-blocking notes

  1. README provider table not updated. Precedent is mixed — Synthorai and OrcaRouter are listed in the table, RunInfra and cheaper-inference are not. If the table is meant to track notable providers, consider adding AnonRouter to the three READMEs; if it's best-effort, ignore this.
  2. Inherent provider limitations worth knowing (no action needed in this PR): AnonRouter rejects array/multimodal message content and unknown fields (n > 1, logprobs, logit_bias), so sending images to an AnonRouter model will fail with a 400 from their side. This is a server-side contract, not something the client wiring can fix.
  3. websites.models points to the marketing page anonrouter.ai/models; the browsable catalog with privacy labels lives at docs.anonrouter.ai/models. Either is fine — just flagging the difference.

Detailed verification log
  • Review basis: PR head 293bd6e2c, merge-base diff against dev (6 files, +118/−1)
  • Registry parity: anonrouter definition is ...OPENAI_BASE, credentialStrategy: 'api-key' — identical shape to cheaper-inference/api-route minus the embeddingStrategy: 'none' override, which is correct here because AnonRouter documents POST /v1/embeddings as supported
  • Endpoint probes (2026-09-19): GET https://anonrouter.ai/ → 200; /models → 200; https://docs.anonrouter.ai/quickstart → 200; https://anonrouter.ai/home/api-keys → 200; GET api.anonrouter.ai/v1/models (no auth) → 404 catch-all, (with Bearer ar_test) → 401 authentication_error; POST api.anonrouter.ai/v1/chat/completions (no auth) → 401
  • Compat-mode gating: GET /v1/auth/capabilities requires auth, so operator-level compat.enabled could not be verified without a key; docs state new keys are compatibility-enabled by default, which this integration relies on (plain bearer, no ticket flow — DeepChat cannot do the ticket dance)
  • anonrouter is not in the PublicProviderConf DB (checked local + remote all.json), so modelSource: 'openai' is the right choice
  • Tests: the basicApiKeyProviders block mirrors the RunInfra test (fetch mock, definition match, discovery assertions, check(), no generate-text); the defaultProviders block mirrors the cheaper-inference one. Proportionate to existing coverage — no over-testing.

@zerob13
zerob13 merged commit 20d4697 into ThinkInAIXYZ:dev Sep 19, 2026
12 checks passed
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.

3 participants