Skip to content

feat(providers): add Chutes AI support - #667

Open
SantiagoDePolonia wants to merge 6 commits into
mainfrom
feat/provider-chutesai
Open

feat(providers): add Chutes AI support#667
SantiagoDePolonia wants to merge 6 commits into
mainfrom
feat/provider-chutesai

Conversation

@SantiagoDePolonia

@SantiagoDePolonia SantiagoDePolonia commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Description

  • add Chutes AI as the chutes provider with CHUTES_API_KEY discovery and the official default endpoint
  • support chat completions, streaming, passthrough, and Responses API translation through chat completions
  • preserve live Chutes catalog metadata including context limits, capabilities, modalities, confidential-compute status, and token pricing
  • reject unsupported embeddings locally and avoid advertising unsupported optional interfaces
  • document provider configuration and add registration, transport, metadata, and environment-discovery coverage

Validation

  • go test ./...
  • repository pre-commit suite, including race tests, lint, performance guard, fix check, and Mintlify validation

AI Generated (optional)

Implemented and validated with Codex.

Summary by CodeRabbit

  • New Features

    • Added Chutes AI as a supported provider.
    • Supports chat, streaming, Responses API translation, passthrough requests, and live model discovery.
    • Preserves model capabilities, limits, metadata, and pricing.
    • Automatically configures the provider when CHUTES_API_KEY is available.
    • Added example configuration with the default Chutes endpoint.
    • Embeddings are not supported.
  • Documentation

    • Documented Chutes credentials, models, capabilities, endpoint configuration, and embedding limitations.

@mintlify

mintlify Bot commented Aug 8, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
gomodel 🟢 Ready View Preview Aug 8, 2026, 6:21 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • Review rate limited - (🔄 Check again to try again)
📝 Walkthrough

Walkthrough

This change adds the Chutes provider with OpenAI-compatible request routing, live model discovery, environment-based configuration, factory registration, tests, and documentation.

Changes

Chutes Provider

Layer / File(s) Summary
Provider routing and request handling
internal/providers/chutes/chutes.go, internal/providers/chutes/chutes_test.go
Adds authenticated chat, streaming, Responses translation, passthrough requests, unsupported embeddings handling, and interface coverage.
Model catalog conversion
internal/providers/chutes/models.go, internal/providers/chutes/models_test.go
Fetches /models, filters invalid entries, and converts metadata, capabilities, limits, and pricing into core models.
Provider discovery and factory registration
internal/providers/config_test.go, run/providers.go, run/providers_test.go
Registers Chutes with its default endpoint and discovers it from CHUTES_API_KEY.
Configuration and provider documentation
config/config.example.yaml, docs/advanced/configuration.mdx, docs/providers/overview.mdx
Documents Chutes configuration, automatic discovery, supported features, model discovery, and endpoint behavior.

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

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant ChutesProvider
  participant OpenAICompatibleClient
  participant ChutesAPI
  Client->>ChutesProvider: Submit chat or Responses request
  ChutesProvider->>OpenAICompatibleClient: Translate and forward request
  OpenAICompatibleClient->>ChutesAPI: Send authenticated chat request
  ChutesAPI-->>OpenAICompatibleClient: Return completion response or stream
  OpenAICompatibleClient-->>ChutesProvider: Return normalized response
  ChutesProvider-->>Client: Return response or stream
Loading

Possibly related issues

Possibly related PRs

  • ENTERPILOT/GoModel#415 — Updates the provider overview documentation with related provider capability information.
  • ENTERPILOT/GoModel#538 — Uses a similar OpenAI-compatible provider integration pattern with discovery, model listing, passthrough, and Responses translation.

Poem

A rabbit checks the Chutes route,
Bearer tokens carry requests out.
Models rise from /models bright,
Chat and Responses share the flight.
Embeddings stay beyond the gate.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.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
Title check ✅ Passed The title clearly and concisely identifies the main change: adding Chutes AI provider support.
Description check ✅ Passed The description explains the changes, validation, and optional AI-generated context, and it aligns with the repository template.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/provider-chutesai

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.

@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 `@config/config.example.yaml`:
- Around line 383-387: Update the chutes configuration example near the base_url
entry to explain when users should override the default, such as when targeting
a custom, self-hosted, or non-default endpoint. Preserve the existing default
URL documentation and use a concise YAML comment.

In `@internal/providers/chutes/chutes_test.go`:
- Around line 14-167: Extend the Chutes tests with coverage for
StreamChatCompletion and Passthrough, asserting each request uses the expected
base URL/path and Bearer authorization. Add a non-2xx upstream-response test for
ChatCompletion or Responses that verifies the provider returns an error. Keep
assertions focused on request translation and normalized responses, consistent
with the existing TestChatCompletion_UsesBearerAuthAndChatEndpoint and
TestResponses_TranslatesToChatCompletions patterns.

In `@internal/providers/chutes/models.go`:
- Around line 47-50: Update the ModelsResponse normalization around
result.Object to assign the OpenAI-compatible value "list" unconditionally,
removing the conditional fallback while preserving the existing response
construction.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: becd3889-513f-4e7c-a764-556884adc64a

📥 Commits

Reviewing files that changed from the base of the PR and between c7eeb8a and 0386a8f.

📒 Files selected for processing (9)
  • config/config.example.yaml
  • docs/advanced/configuration.mdx
  • docs/providers/overview.mdx
  • internal/providers/chutes/chutes.go
  • internal/providers/chutes/chutes_test.go
  • internal/providers/chutes/models.go
  • internal/providers/config_test.go
  • run/providers.go
  • run/providers_test.go

Comment thread config/config.example.yaml
Comment thread internal/providers/chutes/chutes_test.go
Comment thread internal/providers/chutes/models.go Outdated
@codecov-commenter

codecov-commenter commented Aug 8, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
config/config.example.yaml (1)

16-16: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add Chutes to the passthrough allowlist.

enabled_passthrough_providers is the explicit provider allowlist for /p/{provider}/...; Chutes exists in config/config.example.yaml, is marked passthrough-ready in docs/providers/overview.mdx, and implements core.PassthroughProvider, but it is not on this list. Add "chutes" here and align config/server.go and the default enable list with this change.

🤖 Prompt for 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.

In `@config/config.example.yaml` at line 16, Add "chutes" to the
enabled_passthrough_providers example allowlist, then update the corresponding
default provider enable list in config/server.go so both configuration paths
include Chutes consistently.
🤖 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 `@docs/advanced/configuration.mdx`:
- Line 412: Add CHUTES_API_KEY to the Provider API Keys table, documenting it as
the key for the Chutes provider and noting that CHUTES_BASE_URL is optional.
Keep the existing configuration example consistent with the new table entry.

---

Outside diff comments:
In `@config/config.example.yaml`:
- Line 16: Add "chutes" to the enabled_passthrough_providers example allowlist,
then update the corresponding default provider enable list in config/server.go
so both configuration paths include Chutes consistently.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 323cd5ec-9061-4c83-962a-05bcf35b3b1e

📥 Commits

Reviewing files that changed from the base of the PR and between 0386a8f and 153ee15.

📒 Files selected for processing (6)
  • config/config.example.yaml
  • docs/advanced/configuration.mdx
  • docs/providers/overview.mdx
  • internal/providers/config_test.go
  • run/providers.go
  • run/providers_test.go

Comment thread docs/advanced/configuration.mdx
@greptile-apps

greptile-apps Bot commented Aug 8, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

No blocking failure remains.

No accepted blocking findings remain after exercising the Chutes passthrough default and explicit opt-in paths.

T-Rex T-Rex Logs

What T-Rex did

  • The prior race-enabled test established the baseline default-forwarding behavior for the server route.
  • The current focused opt-in enforcement test showed that an opaque POST /p/chutes/provider-native/admin/keys returns HTTP 400 when the provider is not enabled, while an explicitly enabled POST /p/chutes/chat/completions returns HTTP 200 and forwards to the Chutes endpoint.
  • The focused default-configuration test confirmed that Chutes is absent from the effective default passthrough provider list.
  • The code-path validation confirmed that the opaque route is resolved and rejected before forwarding when the provider type is not in the enabled set, and that the opt-in wiring and related tests exercise this behavior in internal/server/passthrough_service.go, internal/server/passthrough_support.go, and the config wiring.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (3): Last reviewed commit: "fix(chutes): require passthrough opt-in" | Re-trigger Greptile

Comment thread internal/server/passthrough_support.go Outdated
@SantiagoDePolonia

Copy link
Copy Markdown
Contributor Author

Addressed the updated Codecov report in a7c34ff. Added focused tests for the previously uncovered Chutes constructor, base-URL override, streaming Responses adapter, model-catalog error/filter paths, optional modalities, and partial pricing. Local package coverage is now 100% of production statements; the full Go test suite, race hook, lint, formatting, performance guard, and fix checks pass.

@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: 2

🤖 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 `@internal/providers/chutes/chutes_test.go`:
- Around line 238-239: Replace the gotBody map in the chat-completions test with
a local typed struct containing Model and Stream fields, using the request
payload’s expected value types; apply the same change to the additional gotBody
declaration around the later test case.
- Around line 30-46: Update the HTTP handlers in
internal/providers/chutes/chutes_test.go:30-46 and
internal/providers/chutes/chutes_test.go:240-270 to assert GET for ListModels
and POST for streaming Responses translation, respectively. Update the catalog
handler in internal/providers/chutes/models_test.go:13-42 to assert GET. Use
each request’s Method field and the corresponding net/http method constants
while preserving the existing path, response, and translation assertions.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 269d14f7-1abc-458d-8742-c6e00f3075e9

📥 Commits

Reviewing files that changed from the base of the PR and between 829102a and a7c34ff.

📒 Files selected for processing (2)
  • internal/providers/chutes/chutes_test.go
  • internal/providers/chutes/models_test.go

Comment thread internal/providers/chutes/chutes_test.go
Comment thread internal/providers/chutes/chutes_test.go Outdated
@SantiagoDePolonia

Copy link
Copy Markdown
Contributor Author

Following maintainer direction, a5a661d enables Chutes in the default passthrough allowlist. The runtime/config defaults, example YAML, passthrough documentation, and enabled-provider error output are aligned, with a server regression test proving that POST /p/chutes/chat/completions reaches Chutes under default settings.

@SantiagoDePolonia

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment thread internal/server/passthrough_support.go Outdated
@SantiagoDePolonia

Copy link
Copy Markdown
Contributor Author

Follow-up to the earlier passthrough-default note: 9d421be restores Chutes passthrough to explicit opt-in after the verified model-less-route authorization finding. Chutes remains fully supported by the passthrough API, but operators must add chutes to ENABLED_PASSTHROUGH_PROVIDERS (or enabled_passthrough_providers) intentionally. The regression now verifies both secure default rejection and successful explicit enablement. All CI checks pass.

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.

2 participants