Repository navigation
Conversation
Slice 1 of HEN-141. A gateway model is a public name for API clients that one or more provider models serve, with aliases: - Tables gateway_models, gateway_model_targets (priority, weight, position) and gateway_model_aliases; names and aliases share one case-insensitive namespace, checked on save; gateway_request_logs.gateway_model_id. - Resolution order presets/, gateway model or alias, provider model. A gateway model picks its first target the key's team may use, ordered by priority with a weighted random order inside one priority. - /models lists every name and alias and hides provider models they cover; responses carry x-oxide-model naming the provider model that served them. - Admin API /api/v1/admin/gateway-models (admin.developer.view, writes need the new admin.developer.models.edit), audited, with translated refusals. - Developer area: Gateway models list and editor (drag-and-drop targets via @vueuse/integrations useSortable, load sharing with weights, retries and time to first chunk stored for slice 2), gateway rows on Models with a price span over the targets, and a Served by column on Logs. - The old GatewayModel type (a provider model a key reaches) is now GatewayProviderModel; GatewayModel names the new table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SbfESZbPGT98Xejhk3ZQj9
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
Slice 1 of HEN-141. A gateway model is a public name for API clients that one or more provider models serve, with aliases: - Tables gateway_models, gateway_model_targets (priority, weight, position) and gateway_model_aliases; names and aliases share one case-insensitive namespace, checked on save; gateway_request_logs.gateway_model_id. - Resolution order presets/, gateway model or alias, provider model. A gateway model picks its first target the key's team may use, ordered by priority with a weighted random order inside one priority. - /models lists every name and alias and hides provider models they cover; responses carry x-oxide-model naming the provider model that served them. - Admin API /api/v1/admin/gateway-models (admin.developer.view, writes need the new admin.developer.models.edit), audited, with translated refusals. - Developer area: Gateway models list and editor (drag-and-drop targets via @vueuse/integrations useSortable, load sharing with weights, retries and time to first chunk stored for slice 2), gateway rows on Models with a price span over the targets, and a Served by column on Logs. - The old GatewayModel type (a provider model a key reaches) is now GatewayProviderModel; GatewayModel names the new table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SbfESZbPGT98Xejhk3ZQj9
Slice 2 and 3 of HEN-141: - GatewayFallbackMiddleware (between guard and provider routing) tries a gateway model's targets in order for retries + 1 rounds, with a 30 s in-memory cooldown per failing target, a first-chunk timeout for streamed requests and a budget reservation per attempt - 400/413/422 are answered at once; 401/403 from a provider move on without retrying that target; 404/429/5xx/timeouts cool it down - Admission skips targets the engine cannot resolve or whose budget refuses; routes rewrite the body model after admission - x-oxide-model and request logs name the target that answered - gateway_route_pins keeps a key's conversation (cache key, session header or conversation start) on the target that last answered, for an hour after last use, pruned hourly - Editor shows targets that are cooling down; the presets Levels tab uses the shared sortable list - Unit, DB and e2e tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SbfESXX6k5T1d2cAhXtdch
Embeddings, rerank, decisions, System One, images and audio requests to a gateway model now try its other targets like chat does: same order, rounds, cooldown and stop rules, judged by the response status, with budget reserved per attempt and the body rewritten to each target's model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SbfESXX6k5T1d2cAhXtdch
…dels Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SbfESXX6k5T1d2cAhXtdch
Henrik-3
marked this pull request as ready for review
December 5, 2026 00:00
|
Automatic reviews are disabled for this repository. Configure in Code Review Settings. |
# Conflicts: # frontend/bun.lock # frontend/package.json
3 tasks done
[FIX] - Pre-bundle the chart library so usage pages open in dev
…oute [FEAT] - Show and configure native endpoints for every model type
- Add gateway model alias management - Show the routes preconfigured providers serve, own APIs included - [FEAT] - Show and configure native endpoints for every model type - [FEAT] - Fall back between gateway model targets on non-chat routes too - [FEAT] - Fall back between gateway model targets and pin conversations - [FEAT] - Add gateway models with aliases and several providers per name
…eChat into feat/gateway-models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Admins can define gateway models in the Developer area: a public name such as
anthropic/claude-sonnet-5, with aliases, that one or more provider models serve. API clients call the name or any alias. When a provider fails, the request moves on to the next one, with configurable retries, and a conversation stays with the provider that answered so its prompt cache is reused./modelslists each name and alias, every gateway response carriesx-oxide-modelnaming the provider model that answered, and request logs show who served the request in a new Served by column.Why
OxideChat should be able to replace LiteLLM's basic gateway features itself: several providers per model, aliases, and failover (retries, cooldown, fallback, a timeout to the first chunk), without relying on an upstream router. Covers all three slices of HEN-141.
How
presets/…first, then as a gateway model name or alias, then as a provider model. A gateway model wins over a provider model with the same ID, which is then hidden from/models. A gateway model with no usable target is "model not found" and never falls through to a provider model; a switched-off one frees its names again.GatewayFallbackMiddleware, between the guard and the provider-routing middleware, so a prompt is checked once, a guard reroute wins and every attempt gets its provider allowlist. It tries the targets forretries + 1rounds; an attempt counts as answered at its first content event, and the first-chunk timeout applies to streamed requests only.media::run_with_fallbackruns the same loop around the skin call, judged by the response status.gateway_route_pins, per key, gateway model and conversation, expiring an hour after last use. The conversation is keyed by the client's cache key, else a session header (x-session-id, Codexsession_id,x-claude-code-session-id), else a hash of the messages up to the first user message. The pinned target goes first, and the pin moves to whichever target answered. Non-chat routes have no pins.GatewayRoutewas already taken, so the tables keep the issue's names and the oldGatewayModeltype (a provider model a key reaches) is nowGatewayProviderModel.SettingsSortableList(drag and drop throughuseSortablefrom@vueuse/integrations, arrows kept for the keyboard).Decided without review, please check:
retriescounts extra rounds over all targets rather than repeats of one target; 401/403 trigger fallback; 404 counts as a failure; the cooldown is fixed at 30 s; pins are per API key, not per team.Breaking changes / migrations
gateway_models,gateway_model_targets,gateway_model_aliasesandgateway_route_pins, the columngateway_request_logs.gateway_model_id, and the permissionadmin.developer.models.edit(granted to the admin role; it also opensGET /api/v1/admin/modelsfor the target picker).gateway_pin_prune_job.gateway_model_idandserved_model_id, developer modelsgateway, admin gateway model targetscooling_down.x-oxide-modelon every gateway inference response.@vueuse/integrations,sortablejs,@types/sortablejs.Testing
cargo clippy --all-targets -- -D warnings: no warnings in the touched files; the crate still has older warnings elsewhere (for exampledoc_markdowninsrc/types/rag/).cargo test: 705 pass. The 5 pgvector tests fail locally only because the local Postgres has novectorextension. Generated frontend types are committed.gateway-models.spec.ts6/6 (including a real fallback past a provider without models and a failing one, and the cooldown badge) andgateway-media.spec.ts3/3 (including embeddings falling back past a failing provider);gateway,presets,preset-levelsandguardrailsalso pass.Linear: https://linear.app/henrik3/issue/HEN-141/gateway-models
Generated by Claude Code