Skip to content

feat(providers): add Cheaper Inference API-key preset - #6336

Closed
aiapienthusiast wants to merge 1 commit into
lidge-jun:devfrom
aiapienthusiast:cheaperinference-provider
Closed

aiapienthusiast wants to merge 1 commit into
lidge-jun:devfrom
aiapienthusiast:cheaperinference-provider

Conversation

@aiapienthusiast

@aiapienthusiast aiapienthusiast commented Sep 30, 2026 •

Copy link
Copy Markdown

Summary

This PR adds Cheaper Inference as an API-key preset in the provider registry.
It uses the same pattern as #6221 (TokenLab).

Cheaper Inference is an OpenAI-compatible LLM gateway.
One API key gives access to models from several labs.

Usage:

ocx provider add cheaperinference

The preset uses the openai-chat adapter at https://api.cheaperinference.com/v1.
Model discovery sends the key to GET /v1/models.
It keeps only rows with type: "text".
Image and video rows are excluded.
The seeded default model is gpt-5.4-mini.
A same-named custom destination is preserved.

Provider evidence

Verification

  • bun test tests/providers/cheaperinference-provider.test.ts tests/providers/tokenlab-provider.test.ts tests/providers/provider-registry-parity.test.ts tests/ci-workflows/docs-provider-preset-counts.test.ts: 92 pass, 0 fail.
  • bun test tests/test-layout-tooling.test.ts: 16 pass, 0 fail.
  • bun x tsc --noEmit: pass.
  • bun run privacy:scan: pass.
  • I did not run the full suite (2 CPU machine).
  • Live check: discovery with a real key listed only text models.
  • Live check: key validation passed.
  • Live check: gpt-5.4-mini returned a reply through the openai-chat adapter.
Details

Files:

  • src/providers/registry/entries-extended.ts: new cheaperinference entry after tokenlab.
  • tests/providers/cheaperinference-provider.test.ts: new test. It uses stubbed fetch only.
  • tests/providers/provider-registry-parity.test.ts: add the id to the expected key list.
  • scripts/test-layout/layout.json, tests/fixtures/test-layout-expected.json: register the new test.
  • docs-site/.../guides/providers.md: table row and setup paragraph.
  • Preset counts recounted to 101 (84 key-based) in the 8 guides, 8 quickstarts and structure/ops/docs-and-release.md.
  • structure/providers-and-adapters.md: short section for the preset.

Tests:

  • Entry points: init, dashboard presets, key login.
  • Routing keeps the bare upstream model id.
  • Discovery URL, Bearer header, and custom destination preservation.
  • Filter keeps only type: "text" rows.
  • Key validation: 200 is valid, 401 is invalid, 503 is unknown.

The new test uses mocks only.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • Required local validation passed; commands, results, and any full-suite exception are documented.

  • I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • New Features
    • Added Cheaper Inference as a provider, with API-key authentication, text-model discovery, and gpt-5.4-mini as the default model.
    • Increased the built-in provider preset catalog to 101, including 84 API-key presets.
  • Documentation
    • Updated setup and provider guides across supported languages with the latest preset counts and provider details.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the enhancement New feature or request label Sep 30, 2026
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 5d57b1cc-2b64-44a5-9d32-abea73b14b0b

📥 Commits

Reviewing files that changed from the base of the PR and between 349588e and 219b137.

📒 Files selected for processing (23)
  • docs-site/src/content/docs/fr/getting-started/quickstart.md
  • docs-site/src/content/docs/fr/guides/providers.md
  • docs-site/src/content/docs/getting-started/quickstart.md
  • docs-site/src/content/docs/guides/providers.md
  • docs-site/src/content/docs/ja/getting-started/quickstart.md
  • docs-site/src/content/docs/ja/guides/providers.md
  • docs-site/src/content/docs/ko/getting-started/quickstart.md
  • docs-site/src/content/docs/ko/guides/providers.md
  • docs-site/src/content/docs/ru/getting-started/quickstart.md
  • docs-site/src/content/docs/ru/guides/providers.md
  • docs-site/src/content/docs/tr/getting-started/quickstart.md
  • docs-site/src/content/docs/tr/guides/providers.md
  • docs-site/src/content/docs/zh-cn/getting-started/quickstart.md
  • docs-site/src/content/docs/zh-cn/guides/providers.md
  • docs-site/src/content/docs/zh-tw/getting-started/quickstart.md
  • docs-site/src/content/docs/zh-tw/guides/providers.md
  • scripts/test-layout/layout.json
  • src/providers/registry/entries-extended.ts
  • structure/ops/docs-and-release.md
  • structure/providers-and-adapters.md
  • tests/fixtures/test-layout-expected.json
  • tests/providers/cheaperinference-provider.test.ts
  • tests/providers/provider-registry-parity.test.ts

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


📝 Walkthrough

Walkthrough

Adds a Cheaper Inference API-key preset with an OpenAI Chat adapter, authenticated model discovery filtered to text rows, and gpt-5.4-mini as the seeded default. Adds provider tests and updates preset-count documentation in English and translated guides.

Changes

Cheaper Inference provider

Layer / File(s) Summary
Registry entry and validation
src/providers/registry/entries-extended.ts, tests/providers/cheaperinference-provider.test.ts, tests/providers/provider-registry-parity.test.ts, scripts/test-layout/layout.json, tests/fixtures/test-layout-expected.json
Adds the Cheaper Inference preset at https://api.cheaperinference.com/v1, using the OpenAI Chat adapter and API-key authentication. Discovery fetches /v1/models with the configured key and retains rows where type is "text". Tests cover routing, custom destinations, model discovery, and API-key validation responses.
Provider documentation and preset counts
docs-site/src/content/docs/guides/providers.md, docs-site/src/content/docs/getting-started/quickstart.md, docs-site/src/content/docs/{fr,ja,ko,ru,tr,zh-cn,zh-tw}/getting-started/quickstart.md, docs-site/src/content/docs/{fr,ja,ko,ru,tr,zh-cn,zh-tw}/guides/providers.md, structure/providers-and-adapters.md, structure/ops/docs-and-release.md
Documents the provider setup, endpoint, adapter, and model discovery. Updates the documented preset totals from 100 to 101 and key-based totals from 83 to 84.

Priority: ⬇️ Low

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CLIorDashboard as CLI or Dashboard
  participant CheaperInferenceRegistry
  participant CheaperInferenceAPI
  User->>CLIorDashboard: Add provider with API key
  CLIorDashboard->>CheaperInferenceRegistry: Resolve provider preset
  CheaperInferenceRegistry->>CheaperInferenceAPI: GET /v1/models with Bearer key
  CheaperInferenceAPI-->>CheaperInferenceRegistry: Return model rows
  CheaperInferenceRegistry->>CheaperInferenceRegistry: Retain rows with type "text"
Loading

Merge Risk: ⚪ Minimal · up to 219b1

The Cheaper Inference preset adds authenticated text-model discovery and chat routing without an established merge-blocking issue. The translated guides remain consistent with their partial catalogs.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 219b1

The integration uses existing safeguards and preserves explicitly configured destinations. Its exposure is limited to users who select the gateway, but credential-change recovery and the complete outbound request path were not fully verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Selecting the canonical preset exposes its configured gateway credential and submitted chat content to the new external service. The observed integration authority is the selected provider configuration, not a newly granted infrastructure privilege. Downstream gateway routing and data retention are outside repository-source coverage.

Trust Boundaries and Controls

  • observed — The credential crosses the configured provider network boundary during discovery. Validation rejects redirects and distinguishes authentication rejection from other failures. Runtime discovery detects redirects and HTTP failures before bounded parsing and model admission. Exact transport matching prevents custom destinations from silently inheriting the canonical registry policy.

Resilience and Maintainability Implications

  • observed — Authority-driven cache clearing increments generations, removes cached catalogs and failure state, and prevents older discovery flights from publishing as current. This is meaningful recovery counterevidence, but inspection did not establish that every credential or destination replacement invokes that clearing path.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (20 skipped: 2… 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 primary change: adding the Cheaper Inference API-key provider preset.
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 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (20 skipped: 20 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (0/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 0/4).

Review readiness checklist

  • ⬜ Required local validation passed; commands, results, and any full-suite exception are documented.
  • ⬜ I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
  • ⬜ I resolved all correct Codex and CodeRabbit findings.
  • ⬜ My PR is ready for review.

0/4 boxes ticked.

This PR stays in draft until every box above is ticked.

@github-actions
github-actions Bot marked this pull request as draft September 30, 2026 18:39
@lidge-jun

Copy link
Copy Markdown
Owner

Thanks for the preset. Maintainer review found two blockers, so this stays open for now:

  1. Evidence for a new credential destination. MAINTAINERS.md requires primary-source evidence before a provider preset can merge, including resale or routing authorization for the upstreams the service fronts. The terms describe routing but do not establish that authorization, and the subprocessor page is marked as a draft and does not name the primary upstream. Please link primary sources for that, or we can land an inert directory entry in src/providers/free-directory.ts instead of a canonical registry entry.
  2. Structure doc budget. structure/providers-and-adapters.md would be 609 lines after rebase (600-line budget), so bun run structure:check fails. The documentation for the preset needs to move into a sibling doc.

Endpoint, authentication, legal entity, maintenance owner and verification date look fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants