Add AnyRouter provider#2218
Conversation
AnyRouter is an OpenAI-compatible model-routing gateway billed from a shared credit balance. Read the balance from its credits API and surface spend in the menu bar like the other API-key providers. Only /api/v1/credits is reachable with an sk-ar-v1- inference key: /api/v1/key requires dashboard session auth, so key-scoped rate limits are not available. Unlike OpenRouter, the credits payload is flat rather than wrapped in `data`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J7Ussus9GfDUGjdabsqyL5 Co-Authored-By: duyetbot <101855044+duyetbot@users.noreply.github.com>
Use the shared UsageFormatter.currencyString instead of a local NumberFormatter, drop the settings error case that could never be thrown, and stop decoding the three credits fields nothing displays (they were required keys, so dropping them also removes a way a payload change could break decoding). Use the black brand logo and a matching graphite accent; the orange mark is retired. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J7Ussus9GfDUGjdabsqyL5 Co-Authored-By: duyetbot <101855044+duyetbot@users.noreply.github.com>
A key whose allowed_endpoints list omits /api/v1/credits is valid but scoped out; AnyRouter answers 403 insufficient_scope. Reporting that as "key rejected" pointed users at the wrong fix, so give it its own error and document it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J7Ussus9GfDUGjdabsqyL5 Co-Authored-By: duyetbot <101855044+duyetbot@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a1a8dd00a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| subtitle: "Store one labeled AnyRouter inference key per environment you want to monitor.", | ||
| placeholder: "Paste AnyRouter API key (sk-ar-v1-…)…", |
There was a problem hiding this comment.
Require AnyRouter management keys for credits
When users add AnyRouter through Settings, this prompts them to store an inference key (sk-ar-v1-…), but the current AnyRouter Credits API docs state that GET /api/v1/credits requires a Management key (ak_…) with read:credits and that LLM keys are not accepted (https://docs.anyrouter.dev/api-reference/credits). Users following this UI/docs path will consistently get rejected credentials and the new provider will never load; the setup should ask for an ak_… management key and the required scope instead.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 16, 2026, 4:32 PM ET / 20:32 UTC. Summary Reproducibility: yes. at source level: use a snapshot with large cumulative Review metrics: 2 noteworthy metrics.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the scoped Do we have a high-confidence way to reproduce the issue? Yes at source level: use a snapshot with large cumulative Is this the best way to solve the issue? No. The provider integration follows existing architecture, but lifetime spend should not be converted into a quota percentage using a current-period balance; balance and lifetime spend should remain separate until period-matched fields exist. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 65e2ae6a6363. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (6 earlier review cycles)
|
|
@clawsweeper re-review Updated AnyRouter to match the current Credits API contract: management key (ak_...) with read:credits, not sk-ar-v1 inference keys. Local verification passed: swift test --filter AnyRouter; make check. |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
@clawsweeper re-review The previous review placeholder for 211791b appears stale after its lease expired. The PR body now reflects the management-key credential contract and local verification: swift test --filter AnyRouter; make check. Please re-review current head. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Retrying because the previous re-review for 211791b is still marked Interrupted and the durable retry has not started. CI is clean; PR body includes the management-key credential fix and verification. Please re-review current head. |
|
@clawsweeper re-review The active review placeholder for 211791b expired without a verdict. CI is clean and the PR body includes the AnyRouter management-key credential fix plus make check verification. Please re-review current head. |
|
@clawsweeper re-review The review placeholder for 211791b expired again without a verdict. CI is clean and the PR body includes the AnyRouter management-key credential fix plus make check verification. Please re-review current head. |
|
@clawsweeper re-review Addressed the remaining AnyRouter Settings prompt finding at 7ccfc94: token-account copy now asks for an ak_ management key with read:credits, and a regression test covers the title/subtitle/placeholder/env injection. Local verification passed: swift test --filter AnyRouter; make check. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Thanks for the work here — the integration code itself is clean (single read-only endpoint, HTTPS-validated override, tests), and that's appreciated. That said, I'm declining AnyRouter as a tracked provider for now. Shipping a provider in CodexBar is an implicit endorsement, so for aggregator/relay services I hold a higher bar than code quality:
Happy to revisit once there's a named operator, clarity on upstream authorization, and some operating history. None of this is a judgment on your contribution — if the service matures, this PR would be a good starting point. |
Summary
/creditscredential contract: use anak_...management key withread:credits; inference keys likesk-ar-v1-...are not accepted by that endpoint.Verification
swift test --filter AnyRoutermake check