Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughSGLang supports optional routing through Anthropic-compatible ChangesSGLang Anthropic endpoint routing
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant SGLProvider
participant EndpointResolver
participant AnthropicHandler
participant SGLang
Client->>SGLProvider: Submit chat or responses request
SGLProvider->>EndpointResolver: Resolve endpoint configuration
EndpointResolver-->>SGLProvider: Return routing decision
SGLProvider->>AnthropicHandler: Build Anthropic Messages request
AnthropicHandler->>SGLang: POST /v1/messages
SGLang-->>AnthropicHandler: Return response or stream
AnthropicHandler-->>Client: Return normalized result
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (6): Last reviewed commit: "fix: adds sgl anthropic compatible apis ..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (2)
framework/configstore/clientconfig.go (1)
845-852: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd table-driven regression coverage for the new hash dimension.
Cover nil, false, and true values, asserting that nil/false produce the same hash while true changes it. Also cover the config reconciliation path that consumes this hash.
As per coding guidelines, Go behavior changes should have table-driven coverage.
🤖 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 `@framework/configstore/clientconfig.go` around lines 845 - 852, Add table-driven regression tests for the hash logic around UseAnthropicEndpoints, covering nil, false, and true values; assert nil and false produce identical hashes while true produces a different hash. Also exercise the configuration reconciliation path that consumes this hash, using existing test helpers and symbols rather than introducing parallel logic.Source: Coding guidelines
core/providers/anthropic/utils.go (1)
3357-3358: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winFix the exported helper name typo.
ResolveUseAnthropicEndpbointsmisspells “Endpoints.” Rename it toResolveUseAnthropicEndpointsand update its callers before this new API becomes widely referenced.Proposed fix
-// ResolveUseAnthropicEndpboints reports whether the request should be routed through Anthropic-compatible endpoints -func ResolveUseAnthropicEndpboints(ctx *schemas.BifrostContext, key schemas.Key) bool { +// ResolveUseAnthropicEndpoints reports whether the request should be routed through Anthropic-compatible endpoints +func ResolveUseAnthropicEndpoints(ctx *schemas.BifrostContext, key schemas.Key) bool {🤖 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 `@core/providers/anthropic/utils.go` around lines 3357 - 3358, Rename the exported helper ResolveUseAnthropicEndpboints to ResolveUseAnthropicEndpoints, correcting “Endpboints” to “Endpoints,” and update every caller and reference to use the corrected API name.
🤖 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 `@core/providers/sgl/sgl.go`:
- Around line 210-215: Update all four Anthropic request build configurations in
the SGL provider to resolve ShouldSendBackRawRequest and
ShouldSendBackRawResponse through the per-request
BifrostContextKeyCaptureRawRequest and BifrostContextKeyCaptureRawResponse
overrides, falling back to the existing provider defaults when no override is
present. Apply the same change consistently across the configurations near the
referenced request-building paths.
In `@transports/config.schema.json`:
- Around line 3935-3940: Move use_anthropic_endpoints into the properties of
sgl_key_config rather than defining it as a sibling object property. Keep it
optional, retain its boolean type and false default, and ensure the enclosing
sgl_key_config schema accepts this field without allowing unrelated additional
properties.
In `@ui/app/workspace/providers/fragments/apiKeysFormFragment.tsx`:
- Around line 767-785: Update the FormDescription for the
key.use_anthropic_endpoints field in the isSGL block to state that only chat
completions and responses requests are routed through SGLang’s
Anthropic-compatible endpoints; explicitly preserve text completions on the
OpenAI-compatible endpoint without changing the switch or provider behavior.
In `@ui/app/workspace/providers/fragments/deploymentsTable.tsx`:
- Around line 302-305: Update the explanatory text near the deployment endpoint
configuration to state that only chat and responses requests use SGLang’s
Anthropic-compatible endpoints; explicitly preserve text completions on the
OpenAI-compatible /v1/completions endpoint.
- Around line 308-309: Update the use_anthropic_endpoints handler in the alias
configuration to persist explicit false when the checkbox is unchecked, rather
than writing undefined, so aliases can override a true key-level setting. Keep
the checked path writing true and ensure the UI reflects the stored alias-level
boolean; only retain inheritance through a separate explicit state if the
existing design requires it.
---
Nitpick comments:
In `@core/providers/anthropic/utils.go`:
- Around line 3357-3358: Rename the exported helper
ResolveUseAnthropicEndpboints to ResolveUseAnthropicEndpoints, correcting
“Endpboints” to “Endpoints,” and update every caller and reference to use the
corrected API name.
In `@framework/configstore/clientconfig.go`:
- Around line 845-852: Add table-driven regression tests for the hash logic
around UseAnthropicEndpoints, covering nil, false, and true values; assert nil
and false produce identical hashes while true produces a different hash. Also
exercise the configuration reconciliation path that consumes this hash, using
existing test helpers and symbols rather than introducing parallel logic.
🪄 Autofix (Beta)
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: CHILL
Plan: Pro Plus
Run ID: 85312c70-77b5-41af-83d4-70bc61750ddb
📒 Files selected for processing (14)
core/providers/anthropic/requestbuilder.gocore/providers/anthropic/utils.gocore/providers/sgl/sgl.gocore/schemas/account.goframework/configstore/clientconfig.goframework/configstore/migrations.goframework/configstore/rdb.goframework/configstore/tables/key.gotransports/bifrost-http/lib/config.gotransports/config.schema.jsonui/app/workspace/providers/fragments/apiKeysFormFragment.tsxui/app/workspace/providers/fragments/deploymentsTable.tsxui/lib/types/config.tsui/lib/types/schemas.ts
dc237d8 to
b865b54
Compare
There was a problem hiding this comment.
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 `@transports/config.schema.json`:
- Line 405: Remove the DeepSeek-specific use_anthropic_endpoints schema and
providers.deepseek wiring until runtime support exists, including the
deepseek_key configuration paths referenced in the diff. Ensure DeepSeek no
longer accepts or exposes this ignored toggle across all affected provider
configuration definitions.
- Around line 3677-3680: Update the base_key.aliases.* use_anthropic_endpoints
schema definition to include a boolean default of false, matching the key-level
definition and persisted contract. Preserve the existing type and description.
🪄 Autofix (Beta)
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: CHILL
Plan: Pro Plus
Run ID: b4648505-27b6-4ab9-9380-e68e4a469e55
📒 Files selected for processing (14)
core/providers/anthropic/requestbuilder.gocore/providers/anthropic/utils.gocore/providers/sgl/sgl.gocore/schemas/account.goframework/configstore/clientconfig.goframework/configstore/migrations.goframework/configstore/rdb.goframework/configstore/tables/key.gotransports/bifrost-http/lib/config.gotransports/config.schema.jsonui/app/workspace/providers/fragments/apiKeysFormFragment.tsxui/app/workspace/providers/fragments/deploymentsTable.tsxui/lib/types/config.tsui/lib/types/schemas.ts
🚧 Files skipped from review as they are similar to previous changes (13)
- ui/lib/types/config.ts
- ui/lib/types/schemas.ts
- core/schemas/account.go
- ui/app/workspace/providers/fragments/apiKeysFormFragment.tsx
- core/providers/anthropic/utils.go
- core/providers/anthropic/requestbuilder.go
- ui/app/workspace/providers/fragments/deploymentsTable.tsx
- framework/configstore/tables/key.go
- framework/configstore/rdb.go
- core/providers/sgl/sgl.go
- framework/configstore/clientconfig.go
- transports/bifrost-http/lib/config.go
- framework/configstore/migrations.go
b865b54 to
6ef7ed4
Compare
There was a problem hiding this comment.
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 `@core/schemas/account.go`:
- Around line 233-234: Update isLegacyShape() to require UseAnthropicEndpoints
== nil before classifying an alias as legacy, ensuring MarshalJSON() preserves
the override when set. Add round-trip tests covering both true and false
UseAnthropicEndpoints values and verify they survive JSON marshaling and
unmarshaling.
In `@ui/app/workspace/providers/fragments/deploymentsTable.tsx`:
- Around line 303-304: Update the endpoint description paragraph near the
deployment routing text to add the missing noun after “Anthropic-compatible,” so
the rendered sentence is grammatically complete.
- Around line 301-310: Associate the “Use Anthropic endpoints” label with the
Switch control by assigning the Switch a unique id and matching the label’s
htmlFor, or by adding an appropriate aria-label directly to the Switch. Update
the label/Switch block without changing its checked, change, or disabled
behavior.
🪄 Autofix (Beta)
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: CHILL
Plan: Pro Plus
Run ID: d9675621-962a-4f73-98eb-f4cfb3e181ce
📒 Files selected for processing (14)
core/providers/anthropic/requestbuilder.gocore/providers/anthropic/utils.gocore/providers/sgl/sgl.gocore/schemas/account.goframework/configstore/clientconfig.goframework/configstore/migrations.goframework/configstore/rdb.goframework/configstore/tables/key.gotransports/bifrost-http/lib/config.gotransports/config.schema.jsonui/app/workspace/providers/fragments/apiKeysFormFragment.tsxui/app/workspace/providers/fragments/deploymentsTable.tsxui/lib/types/config.tsui/lib/types/schemas.ts
🚧 Files skipped from review as they are similar to previous changes (11)
- core/providers/anthropic/utils.go
- ui/lib/types/config.ts
- ui/app/workspace/providers/fragments/apiKeysFormFragment.tsx
- core/providers/anthropic/requestbuilder.go
- transports/bifrost-http/lib/config.go
- framework/configstore/clientconfig.go
- ui/lib/types/schemas.ts
- transports/config.schema.json
- framework/configstore/migrations.go
- core/providers/sgl/sgl.go
- framework/configstore/rdb.go
6ef7ed4 to
9be779a
Compare
9be779a to
d660a54
Compare
d660a54 to
2af938f
Compare
Merge activity
|
…q#5305) ## Summary Adds a `use_anthropic_endpoints` flag to SGLang keys and aliases that routes chat completion, streaming, and responses requests through SGLang's Anthropic-compatible `/v1/messages` endpoint instead of its default OpenAI-compatible endpoints. This enables users running SGLang with Anthropic-format models to take advantage of native Anthropic request/response semantics without switching providers. ## Changes - Added `UseAnthropicEndpoints *bool` to `schemas.Key` and `AliasConfig`, with full persistence through the RDB config store and key hash generation. - Added `ResolveUseAnthropicEndpboints` helper in the Anthropic utils package that checks the resolved alias config first, then falls back to the key-level flag. - Registered `schemas.SGL` in `AnthropicProviderRequestDefaultsMap` so the Anthropic request builder accepts SGL as a valid provider. - Updated `SGLProvider.ChatCompletion`, `ChatCompletionStream`, `Responses`, and `ResponsesStream` to branch on the flag and delegate to the shared Anthropic handlers (`HandleAnthropicChatCompletionRequest`, `HandleAnthropicChatCompletionStreaming`, `HandleAnthropicResponsesRequest`, `HandleAnthropicResponsesStream`) with a Bearer auth + `anthropic-version: 2023-06-01` header set. - `TextCompletion` intentionally always uses the OpenAI-compatible endpoint, as SGLang's Anthropic-compatible layer does not expose a legacy text-completions surface. - Added a database migration (`add_use_anthropic_endpoints_column`) to add the column to `config_keys`. - Updated `config.schema.json` to expose `use_anthropic_endpoints` on both the key and alias levels for SGLang. - Added a UI toggle in the API keys form (key-level) and a new `SGLSection` in the deployments table (alias-level override). - Updated TypeScript types and Zod schemas to include `use_anthropic_endpoints`. ## Type of change - [ ] Bug fix - [x] Feature - [ ] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [x] Core (Go) - [x] Transports (HTTP) - [x] Providers/Integrations - [ ] Plugins - [x] UI (React) - [ ] Docs ## How to test ```sh # Core/Transports go test ./... # UI cd ui pnpm i pnpm build ``` 1. Configure an SGLang provider key with `use_anthropic_endpoints: true` (via config file or UI toggle). 2. Send a chat completion request routed to the SGLang provider and confirm the request is forwarded to `/v1/messages` with `anthropic-version: 2023-06-01` and a Bearer token. 3. Send a streaming chat completion and responses request and confirm the same routing. 4. Confirm that without the flag set (or set to `false`), requests continue to use the OpenAI-compatible endpoints. 5. Set `use_anthropic_endpoints` on an alias config and confirm it overrides the key-level setting. 6. Verify the database migration runs cleanly on a fresh and existing database. ## Breaking changes - [ ] Yes - [x] No ## Related issues ## Security considerations The `use_anthropic_endpoints` flag does not introduce new secret handling. Authentication continues to use the existing key secret via Bearer token, consistent with the existing OpenAI-compatible path. ## Checklist - [x] I read `docs/contributing/README.md` and followed the guidelines - [x] I added/updated tests where appropriate - [x] I updated documentation where needed - [x] I verified builds succeed (Go and UI) - [x] I verified the CI pipeline passes locally if applicable
…q#5305) ## Summary Adds a `use_anthropic_endpoints` flag to SGLang keys and aliases that routes chat completion, streaming, and responses requests through SGLang's Anthropic-compatible `/v1/messages` endpoint instead of its default OpenAI-compatible endpoints. This enables users running SGLang with Anthropic-format models to take advantage of native Anthropic request/response semantics without switching providers. ## Changes - Added `UseAnthropicEndpoints *bool` to `schemas.Key` and `AliasConfig`, with full persistence through the RDB config store and key hash generation. - Added `ResolveUseAnthropicEndpboints` helper in the Anthropic utils package that checks the resolved alias config first, then falls back to the key-level flag. - Registered `schemas.SGL` in `AnthropicProviderRequestDefaultsMap` so the Anthropic request builder accepts SGL as a valid provider. - Updated `SGLProvider.ChatCompletion`, `ChatCompletionStream`, `Responses`, and `ResponsesStream` to branch on the flag and delegate to the shared Anthropic handlers (`HandleAnthropicChatCompletionRequest`, `HandleAnthropicChatCompletionStreaming`, `HandleAnthropicResponsesRequest`, `HandleAnthropicResponsesStream`) with a Bearer auth + `anthropic-version: 2023-06-01` header set. - `TextCompletion` intentionally always uses the OpenAI-compatible endpoint, as SGLang's Anthropic-compatible layer does not expose a legacy text-completions surface. - Added a database migration (`add_use_anthropic_endpoints_column`) to add the column to `config_keys`. - Updated `config.schema.json` to expose `use_anthropic_endpoints` on both the key and alias levels for SGLang. - Added a UI toggle in the API keys form (key-level) and a new `SGLSection` in the deployments table (alias-level override). - Updated TypeScript types and Zod schemas to include `use_anthropic_endpoints`. ## Type of change - [ ] Bug fix - [x] Feature - [ ] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [x] Core (Go) - [x] Transports (HTTP) - [x] Providers/Integrations - [ ] Plugins - [x] UI (React) - [ ] Docs ## How to test ```sh # Core/Transports go test ./... # UI cd ui pnpm i pnpm build ``` 1. Configure an SGLang provider key with `use_anthropic_endpoints: true` (via config file or UI toggle). 2. Send a chat completion request routed to the SGLang provider and confirm the request is forwarded to `/v1/messages` with `anthropic-version: 2023-06-01` and a Bearer token. 3. Send a streaming chat completion and responses request and confirm the same routing. 4. Confirm that without the flag set (or set to `false`), requests continue to use the OpenAI-compatible endpoints. 5. Set `use_anthropic_endpoints` on an alias config and confirm it overrides the key-level setting. 6. Verify the database migration runs cleanly on a fresh and existing database. ## Breaking changes - [ ] Yes - [x] No ## Related issues ## Security considerations The `use_anthropic_endpoints` flag does not introduce new secret handling. Authentication continues to use the existing key secret via Bearer token, consistent with the existing OpenAI-compatible path. ## Checklist - [x] I read `docs/contributing/README.md` and followed the guidelines - [x] I added/updated tests where appropriate - [x] I updated documentation where needed - [x] I verified builds succeed (Go and UI) - [x] I verified the CI pipeline passes locally if applicable

Summary
Adds a
use_anthropic_endpointsflag to SGLang keys and aliases that routes chat completion, streaming, and responses requests through SGLang's Anthropic-compatible/v1/messagesendpoint instead of its default OpenAI-compatible endpoints. This enables users running SGLang with Anthropic-format models to take advantage of native Anthropic request/response semantics without switching providers.Changes
UseAnthropicEndpoints *booltoschemas.KeyandAliasConfig, with full persistence through the RDB config store and key hash generation.ResolveUseAnthropicEndpbointshelper in the Anthropic utils package that checks the resolved alias config first, then falls back to the key-level flag.schemas.SGLinAnthropicProviderRequestDefaultsMapso the Anthropic request builder accepts SGL as a valid provider.SGLProvider.ChatCompletion,ChatCompletionStream,Responses, andResponsesStreamto branch on the flag and delegate to the shared Anthropic handlers (HandleAnthropicChatCompletionRequest,HandleAnthropicChatCompletionStreaming,HandleAnthropicResponsesRequest,HandleAnthropicResponsesStream) with a Bearer auth +anthropic-version: 2023-06-01header set.TextCompletionintentionally always uses the OpenAI-compatible endpoint, as SGLang's Anthropic-compatible layer does not expose a legacy text-completions surface.add_use_anthropic_endpoints_column) to add the column toconfig_keys.config.schema.jsonto exposeuse_anthropic_endpointson both the key and alias levels for SGLang.SGLSectionin the deployments table (alias-level override).use_anthropic_endpoints.Type of change
Affected areas
How to test
use_anthropic_endpoints: true(via config file or UI toggle)./v1/messageswithanthropic-version: 2023-06-01and a Bearer token.false), requests continue to use the OpenAI-compatible endpoints.use_anthropic_endpointson an alias config and confirm it overrides the key-level setting.Breaking changes
Related issues
Security considerations
The
use_anthropic_endpointsflag does not introduce new secret handling. Authentication continues to use the existing key secret via Bearer token, consistent with the existing OpenAI-compatible path.Checklist
docs/contributing/README.mdand followed the guidelines