Skip to content

feat(sglang): add SGLang provider - #664

Merged
SantiagoDePolonia merged 2 commits into
mainfrom
feat/sglang
Aug 8, 2026
Merged

feat(sglang): add SGLang provider#664
SantiagoDePolonia merged 2 commits into
mainfrom
feat/sglang

Conversation

@SantiagoDePolonia

@SantiagoDePolonia SantiagoDePolonia commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Description

  • add SGLang as a dedicated provider backed by GoModel's OpenAI-compatible client
  • support optional bearer authentication, environment discovery, key rotation, and OpenAI-compatible chat, streaming, Responses, embeddings, and model listing
  • route SGLang-native endpoints such as /generate through provider passthrough while preserving explicit /v1 endpoints
  • add configuration, Helm chart, dashboard, cost fallback, and provider documentation coverage

Testing

  • full Go test suite
  • repository commit hooks, including race tests, lint, dashboard tests/build sync, performance guards, and Mintlify validation
  • local end-to-end test on Apple M4 Pro with SGLang's MLX backend and Qwen/Qwen3-0.6B, covering model discovery, chat, streaming, Responses, and native /generate passthrough

AI Generated (optional)

Implementation and tests were produced with Codex and reviewed and verified locally.

Summary by CodeRabbit

  • New Features

    • Added SGLang as a supported provider for chat, streaming, responses, embeddings, model discovery, and passthrough requests.
    • Supports OpenAI-compatible and native SGLang endpoints, configurable base URLs, and optional bearer-token authentication.
    • Added SGLang configuration support across environment variables, YAML, and Helm deployments.
    • Included SGLang in default provider lists and dashboard documentation links.
  • Documentation

    • Added setup guidance for local deployments, Docker, multiple instances, authentication, and supported capabilities.

@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, 4:45 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 21169900-8eef-4c07-8f3d-50f8f29420f7

📥 Commits

Reviewing files that changed from the base of the PR and between f8f6b98 and 4b205e5.

📒 Files selected for processing (6)
  • .env.template
  • CLAUDE.md
  • internal/providers/config_test.go
  • internal/providers/sglang/sglang.go
  • internal/providers/sglang/sglang_test.go
  • run/providers_test.go

📝 Walkthrough

Walkthrough

Adds SGLang as a supported provider with OpenAI-compatible APIs, native passthrough routing, optional bearer authentication, environment discovery, Helm configuration, documentation, dashboard linking, and test coverage.

Changes

SGLang provider implementation

Layer / File(s) Summary
Provider client and routing
internal/providers/sglang/*
Adds typed endpoints, streaming, optional authentication, native and /v1 passthrough routing, response preservation, retries, hooks, circuit breakers, and base URL updates. Tests cover routing, request fields, interfaces, key rotation, and URL updates.

Runtime integration

Layer / File(s) Summary
Provider registration and runtime configuration
run/providers.go, run/providers_test.go, internal/providers/config_test.go, config/*, internal/server/*, internal/usage/*
Registers SGLang, adds environment discovery and default passthrough enablement, and updates configuration, pricing, and regression tests.

Deployment configuration

Layer / File(s) Summary
Helm values and validation
helm/values.yaml, helm/values.schema.json, helm/README.md
Adds SGLang enablement, base URL, optional API key, secret mappings, schema validation, and a keyless installation example.

Documentation and dashboard discovery

Layer / File(s) Summary
Provider documentation and navigation
README.md, CLAUDE.md, .env.template, docs/advanced/*, docs/providers/*, docs/features/*, docs/guides/production.mdx, docs/docs.json
Documents SGLang setup, environment variables, model discovery, multiple instances, native passthrough routes, authentication, capabilities, and local deployment support.
Dashboard provider links
web/dashboard/src/pages/overview/providersLogic.js, web/dashboard/tests/overview-providers.test.js
Maps the sglang provider type to its documentation page and tests the generated URL.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • ENTERPILOT/GoModel#170: Adds a separate OpenAI-compatible provider across registration, configuration, Helm, documentation, and tests.
  • ENTERPILOT/GoModel#591: Covers credential-schema and discovery patterns used by the SGLang registration.
  • ENTERPILOT/GoModel#665: Adds another provider with parallel registration, configuration, passthrough, documentation, Helm, and dashboard changes.

Poem

A rabbit routed /v1 with care,
While native paths flowed through the air.
Keys can guard, or stay aside,
Config and Helm now work worldwide.
SGLang hops through every test,
Documented and registered best.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.83% 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 SGLang as a provider.
Description check ✅ Passed The description explains the changes, motivation, testing, and optional AI-generated context, and it includes the required Description section.
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/sglang

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.

@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

❌ Patch coverage is 94.94949% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/providers/sglang/sglang.go 94.84% 3 Missing and 2 partials ⚠️

📢 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: 4

🤖 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 `@CLAUDE.md`:
- Around line 139-141: Update the provider documentation in the “Provider API
key rotation” section to remove SGLang and vLLM from the keyless/unaffected
provider list. Preserve wording that they support optional API-key
authentication, rotation slots, session affinity, and dashboard api_keys
configuration; leave Ollama and non-API-key providers unchanged.

In `@docs/features/passthrough-api.mdx`:
- Around line 134-135: Update the passthrough provider defaults documented in
CLAUDE.md to match the runtime configuration: include openai, anthropic,
openrouter, kilo, zai, sglang, vllm, and deepseek, preserving the existing
formatting and wording.

In `@internal/providers/config_test.go`:
- Around line 946-971: Update the SGLang discovery tests around
TestApplyProviderEnvVarsDiscoversSGLangWithoutAPIKey and
TestApplyProviderEnvVarsDiscoversSGLangFromAPIKeyWithDefaultBaseURL to clear
provider environment variables before each case, preventing ambient
SGLANG_BASE_URL or SGLANG_API_KEY values from affecting results. Consolidate
both scenarios into a table-driven test while preserving their distinct
environment setup and assertions.

In `@run/providers_test.go`:
- Around line 49-54: Update TestDefaultProviderFactoryCredentialForms to compare
the complete set of required fields from the provider schema against each test
case’s required value, including the sglang row’s required: nil expectation. Do
not limit validation to fields listed in tt.required; ensure schema-required
fields such as base_url cause the test to fail when the expected credential form
is keyless.
🪄 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: 5ab426ef-15e4-4665-add5-32a12aa406de

📥 Commits

Reviewing files that changed from the base of the PR and between aefa498 and f8f6b98.

⛔ Files ignored due to path filters (2)
  • internal/admin/dashboard/static/dist/assets/index-CiIXCM_n.js is excluded by !**/dist/**
  • internal/admin/dashboard/static/dist/index.html is excluded by !**/dist/**
📒 Files selected for processing (28)
  • CLAUDE.md
  • README.md
  • config/config.example.yaml
  • config/config.go
  • config/config_test.go
  • config/server.go
  • docs/advanced/config-yaml.mdx
  • docs/advanced/configuration.mdx
  • docs/docs.json
  • docs/features/passthrough-api.mdx
  • docs/guides/production.mdx
  • docs/providers/overview.mdx
  • docs/providers/sglang.mdx
  • helm/README.md
  • helm/values.schema.json
  • helm/values.yaml
  • internal/providers/config_test.go
  • internal/providers/sglang/passthrough_semantics.go
  • internal/providers/sglang/sglang.go
  • internal/providers/sglang/sglang_test.go
  • internal/server/handlers_test.go
  • internal/server/passthrough_support.go
  • internal/usage/cost.go
  • internal/usage/cost_test.go
  • run/providers.go
  • run/providers_test.go
  • web/dashboard/src/pages/overview/providersLogic.js
  • web/dashboard/tests/overview-providers.test.js

Comment thread CLAUDE.md Outdated
Comment thread docs/features/passthrough-api.mdx
Comment thread internal/providers/config_test.go Outdated
Comment thread run/providers_test.go
@greptile-apps

greptile-apps Bot commented Aug 8, 2026

Copy link
Copy Markdown

Confidence Score: 4/5

Not merge-safe: two documented SGLang passthrough routes target incorrect upstream paths.

There is one independent, verified P1 non-security finding, which maps to a confidence score of 4.

Files Needing Attention: internal/providers/sglang/sglang.go needs to classify /rerank and /tokenize as endpoints using the /v1 upstream base path.

T-Rex T-Rex Logs

What T-Rex did

  • T-Rex prepared a focused gateway-to-SGLang routing test source to exercise the P1 scenario.
  • T-Rex inspected routing-related logs to observe current routing for SGLang rerank and tokenize aliases.
  • T-Rex cross-checked the test results against expected SGLang v1 routing assertion failures to validate the posting review finding.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "feat(sglang): add SGLang provider" | Re-trigger Greptile

Comment thread internal/providers/sglang/sglang.go
@SantiagoDePolonia
SantiagoDePolonia merged commit 7f41e7b into main Aug 8, 2026
20 checks passed
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