Skip to content

feat(providers): add Chutes preset - #1315

Draft
olddonkey wants to merge 2 commits into
lidge-jun:devfrom
olddonkey:codex/572-chutes-model-api
Draft

feat(providers): add Chutes preset#1315
olddonkey wants to merge 2 commits into
lidge-jun:devfrom
olddonkey:codex/572-chutes-model-api

Conversation

@olddonkey

@olddonkey olddonkey commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a canonical chutes key preset for Chutes' shared OpenAI-compatible LLM gateway at https://llm.chutes.ai/v1.
  • Discover models through the registry-owned public catalog, admit only rows whose supported_features include tools, preserve slash-containing model ids and safe live metadata, and bound the raw response to 256 KiB / 128 rows.
  • Keep capability claims conservative: no reasoning-effort ladder, no provider-wide parallel tool-call claim, and no false key-validation success from a public catalog.
  • Preserve older same-named custom destinations/adapters, add fixture-only regression coverage, and sync the provider catalog across all five docs locales. The docs count is corrected to the current 79 total / 67 key presets.

Relates to #572. This PR intentionally does not close the umbrella issue.

Canonical preset evidence

Primary sources checked on 2026-08-08:

  • Chutes pricing documents the shared https://llm.chutes.ai/v1/chat/completions gateway, Bearer key, and pay-per-token public inference.
  • Chutes authentication docs document dashboard/CLI API-key creation and Bearer authentication.
  • The official public /v1/models endpoint returned 13 rows (about 11 KiB); 11 explicitly advertised tools in supported_features. Tests use a checked-in representative fixture and never call this endpoint.
  • Chutes Terms of Service identify Chutes Global Corp as the operator, expressly cover API consumers, and direct production/high-volume automated inference to PAYGO.

Maintenance owner: @olddonkey. No affiliation with Chutes.

Security and scope

  • preserveCustomDestination prevents an existing same-named custom provider/key from being silently retargeted to Chutes.
  • Discovery policy stays registry-only and is not copied into config.json or the key-login map.
  • The shared discovery contract enforces HTTPS destination checks, redirect refusal, response-byte bounds, and raw-row bounds before catalog admission.
  • Because /v1/models is public, apiKeyValidation is explicitly unknown; chat requests still send the configured Bearer key only to the matching fixed transport.
  • User-deployed custom Chute hosts and Chutes' non-LLM APIs remain out of scope and require a custom provider.
  • This credential-destination change requests explicit maintainer security review.

Verification

  • bun test tests/chutes-provider.test.ts tests/provider-registry-parity.test.ts tests/provider-model-discovery-contract.test.ts — 67 pass, 0 fail
  • bun run typecheck
  • bun run test — 10,061 pass, 7 skip, 0 fail across 628 files
  • bun run privacy:scan
  • cd docs-site && bun run build — 221 pages
  • git diff --check
  • Registry count audit — 79 total, 67 key, 8 OAuth, 3 local, 1 forward

No GUI source changed, so there is no screenshot.

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.

Summary by CodeRabbit

  • New Features

    • Added Chutes as an API provider with OpenAI-compatible endpoint support.
    • Added live model discovery, including filtering for tool-capable models.
    • Added support for custom Chutes hosts and documented authentication behavior.
    • Increased built-in provider presets from 76 to 79.
  • Documentation

    • Updated setup and provider guides in all supported languages with Chutes configuration, discovery, limits, and usage details.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f69bff52-97f0-49ec-91b2-75ad2d2ed372

📥 Commits

Reviewing files that changed from the base of the PR and between 085b2df and 8f4201f.

📒 Files selected for processing (2)
  • tests/chutes-provider.test.ts
  • tests/fixtures/chutes-models.json

📝 Walkthrough

Walkthrough

The change adds Chutes as an API-key provider with bounded discovery of tool-capable models. It adds provider-specific tests and fixture data. Provider counts and Chutes usage details are documented in five locales.

Changes

Chutes Provider

Layer / File(s) Summary
Registry integration and parity validation
src/providers/registry.ts, tests/provider-registry-parity.test.ts
Registers the Chutes OpenAI-compatible gateway with Bearer authentication, bounded model discovery, tool-support filtering, conservative capabilities, and custom-destination preservation.
Provider discovery and routing tests
tests/chutes-provider.test.ts, tests/fixtures/chutes-models.json
Tests registry metadata, derived presets, authenticated requests, unknown key validation, bounded discovery, tool-capable filtering, model routing, request field filtering, and custom provider preservation.
Localized provider documentation
docs-site/src/content/docs/...
Updates preset counts and documents the Chutes endpoint, discovery rules, response limits, authentication behavior, and custom-host scope in English, Japanese, Korean, Russian, and Simplified Chinese.

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

Possibly related issues

Possibly related PRs

  • lidge-jun/opencodex#652 — Introduces the registry-owned model-discovery contract used by the Chutes configuration.
  • lidge-jun/opencodex#406 — Adds provider discovery infrastructure used by Chutes tool-capable model discovery.
  • lidge-jun/opencodex#923 — Uses the same API-key provider pattern with bounded discovery and unknown key validation.

Suggested labels: review-ready

Suggested reviewers: ingwannu, lidge-jun, wibias

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ProviderRegistry
  participant ChutesGateway
  Client->>ProviderRegistry: load Chutes preset
  ProviderRegistry->>ChutesGateway: fetch public /v1/models
  ChutesGateway-->>ProviderRegistry: return model metadata
  ProviderRegistry-->>Client: expose tool-capable models
  Client->>ChutesGateway: send chat request with Bearer key
Loading
🚥 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%. 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 identifies the main change: adding the Chutes 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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 added the enhancement New feature or request label Aug 8, 2026
@olddonkey
olddonkey marked this pull request as ready for review August 8, 2026 20:07

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/chutes-provider.test.ts`:
- Around line 197-220: Extend the test "does not retarget an older same-named
custom provider or adapter" with a near-miss custom provider using adapter
"openai-chat" and baseUrl "https://llm.chutes.ai/v2", then assert
resolveProviderModelDiscovery("chutes", that provider).spec is undefined to
verify it is excluded from registry discovery.
- Around line 50-51: Remove the file-wide allowPrivateNetwork: true from the
Chutes provider configuration passed through providerConfig(). If fixture-only
discovery requires the bypass, apply it only in the specific fixture-fetch
helper or test and update the comment to explicitly identify it as a DNS
classification bypass.

In `@tests/fixtures/chutes-models.json`:
- Around line 28-49: Add a fixture row in chutes-models.json with
supported_features including tools while leaving context_length and
input_modalities null or omitted, so it passes the tool filter and exercises
metadata fallback handling. Update the expected model ID list in the relevant
chutes-provider test to include the new fixture, preserving existing
expectations.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 35ba7001-f728-410b-b76b-ad49124305fb

📥 Commits

Reviewing files that changed from the base of the PR and between 6a7e5f0 and 085b2df.

📒 Files selected for processing (14)
  • 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/zh-cn/getting-started/quickstart.md
  • docs-site/src/content/docs/zh-cn/guides/providers.md
  • src/providers/registry.ts
  • tests/chutes-provider.test.ts
  • tests/fixtures/chutes-models.json
  • tests/provider-registry-parity.test.ts

Comment thread tests/chutes-provider.test.ts Outdated
Comment thread tests/chutes-provider.test.ts
Comment thread tests/fixtures/chutes-models.json

@Wibias Wibias 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.

Maintainer + security review verdict: REQUEST CHANGES.

I reviewed the provider registry entry, discovery contract, request path, collision-preservation tests, fixture admission logic, docs, current CodeRabbit state, current dev, and the linked primary-source evidence.

Security/correctness findings: I did not find a credential leak, silent credential retarget, SSRF/path-injection route, unbounded catalog read, or unsafe trust inheritance in the Chutes implementation. preserveCustomDestination, exact transport matching, registry-only discovery policy, 256 KiB/128-row bounds, fail-closed tool filtering, and apiKeyValidation: "unknown" are the right shape. I also independently rechecked the current Chutes first-party docs: the shared https://llm.chutes.ai/v1 gateway, Bearer auth, and live GET /v1/models contract are now explicitly documented; the current ToS identifies Chutes Global Corp and covers API consumers/PAYGO automation. The preset is useful and directly serves #572.

Blocking changes:

  1. Rebase onto current dev and rerun CI. This head is now ~54 dev commits behind. The existing green CI proves 8f4201f5, not the current integration result; provider/catalog contracts have moved materially since this branch point.
  2. Fix the standalone provider counts. Current dev documents 76 total / 64 key presets. This PR adds one provider, but changes every locale to 79 / 67. Merged by itself, that publishes a count two providers ahead of the registry. Update the counts to the actual post-rebase/post-merge state (or avoid batch-count churn until the three provider PRs are integrated sequentially).

All earlier CodeRabbit findings on this PR are resolved, and I found no additional production/security blocker beyond the two items above. Re-request review on the rebased exact head with fresh CI.

@Wibias
Wibias marked this pull request as draft August 9, 2026 02:38
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