Skip to content

Add OAuth and API-key model routes - #22

Merged
hawkff merged 1 commit into
mainfrom
feat/credential-routes
Oct 11, 2026
Merged

hawkff merged 1 commit into
mainfrom
feat/credential-routes

Conversation

@hawkff

@hawkff hawkff commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Add api/ and oauth/ model entries with API key and OAuth labels. Preserve full routed IDs for chat and media requests.

API-key routes skip subscription quota lookup. OAuth routes retain alias-aware quota handling. Document the CLIProxyAPI v8 prefix setup and configuration migration.

Summary by CodeRabbit

  • New Features
    • Added support for selecting OAuth- and API-key-routed models and media using oauth/ and api/ prefixes. These routes are labeled by authentication type, and recognized model aliases can use their canonical model metadata.
    • Improved quota handling for OAuth-routed models while keeping API-key billing and rate errors from triggering OAuth quota checks or route fallback.
  • Documentation
    • Expanded setup guidance for OAuth and API-key routes, including route labels, model IDs, proxy configuration, and refresh and selection steps.

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no actionable issues were found.

Summary

Adds separate api/ and oauth/ model entries while keeping full advertised IDs on requests.

  • Chat model routes show which credential the proxy will use.
  • Claude quota checks follow API-key and OAuth routes separately.
  • Supported media models can use API-key and OAuth routes.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Advertised model ID] --> B[Resolve metadata and route label]
  B --> C[Chat request]
  B --> D[Media request]
  C --> E[Send full advertised ID]
  D --> E
  C --> F{Claude quota error}
  F --> G[API route: response-based wait only]
  F --> H[OAuth route: matching subscription lookup]
  G --> I[Retry same full ID]
  H --> I
Loading

Reviews (1) · Last reviewed commit: "Add OAuth and API-key model routes" · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Review in 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: a07241ed-8b40-4709-9087-f21d8a801e60

📥 Commits

Reviewing files that changed from the base of the PR and between a37d56d and b7b557a.


📒 Files selected for processing (7)
  • README.md
  • src/catalog.ts
  • src/claude-quota.ts
  • src/media-defaults.ts
  • src/provider.ts
  • test/auth-routes.test.ts
  • test/provider.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Walkthrough

Walkthrough

The change adds api/ and oauth/ model routes to catalog mapping and provider handling. It also updates media selection, Claude quota lookup, tests, and documentation for route labels, configuration, and selection.

Changes

Credential-prefixed model routes

Layer / File(s) Summary
Route recognition and catalog mapping
src/catalog.ts, src/media-defaults.ts, test/auth-routes.test.ts, test/provider.test.ts, README.md
The catalog recognizes api/ and oauth/ prefixes and uses metadata aliases for routed IDs. Media selection and picker tests cover these prefixes. The README documents supported routes, aliases, and route configuration.
Route-aware provider execution and quota handling
src/claude-quota.ts, src/provider.ts, test/provider.test.ts, README.md
The provider applies route-aware Google adaptation and excludes API-key routes from live Claude quota handling. Tests cover API-key and OAuth request behavior, quota lookup, and other prefixed-model paths. The refresh-scope version changes from 4 to 5; the README describes route-specific quota behavior.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Provider
  participant ManagementAPI
  participant MessagesAPI
  Client->>Provider: Request using a prefixed model ID
  alt API-key route
    Provider->>MessagesAPI: Send full api/ model ID
    MessagesAPI-->>Provider: Return upstream response
  else OAuth route
    Provider->>ManagementAPI: Look up Claude quota
    ManagementAPI-->>Provider: Return quota status
    Provider->>MessagesAPI: Send full oauth/ model ID
    MessagesAPI-->>Provider: Return upstream response
  end
  Provider-->>Client: Return response or quota result
Loading

Merge Risk: ⚪ Minimal · up to b7b55

This change adds OAuth and API-key model routes with route-specific quota handling and documentation. No concrete merge-blocking risk was found.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 6 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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 OAuth and API-key model routes.
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.

Full details: Docstring Coverage

Explanation

Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 6 files. (1 skipped: 1 unsupported.)


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR


🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@hawkff
hawkff merged commit 224fb44 into main Oct 11, 2026
6 checks passed
@hawkff
hawkff deleted the feat/credential-routes branch October 11, 2026 20:38
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