Repository navigation
[STALE: REBASE FROM NEW FORK] feat(providers): xAI by API key as its own provider; keys never take the sign-ins' traffic (.21) - #19
Draft
vadymhimself wants to merge 1 commit into
Conversation
…the sign-ins' traffic (.21) AgentRadar AGE-2278 lets a company add an API key for Claude, Codex or Grok and run it in its model waterfall next to the subscription sign-ins. The gateway needs two things for that. xai-apikey is a new key provider for https://api.x.ai/v1, placed next to the OpenAI and Anthropic key rows. It carries the same lineup and wire metadata as the xai sign-in row, but no default model. A company key written onto the xai row itself would replace the Grok sign-ins through allowKeyAuthOverride, so the key gets its own row. Bare model ids now reach a signed-in provider before its -apikey twin, whatever order the config was written in. Before this, a key added before the first sign-in sat earlier in the config, and routeByKnownModelPattern, the configured-default-model step and the model-list step all took the first match, so a bare claude-* or grok-* request went to the key. Pinned AgentRadar requests already refused a key route; unpinned ones could have spent the key. A key is now reached only through its own namespace (anthropic-apikey/..., xai-apikey/...). Tests: tests/routing/router.test.ts adds a control (a key alone serves bare ids) and the no-hijack row (keys written first, every bare id still lands on the sign-ins, the key only by its namespace). The parity list gains xai-apikey. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Its title has been prefixed with |
Collaborator
Author
|
This PR is based on the superseded 2.65 gateway line. Rebuild the change from |
This branch has not been deployed
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
AgentRadar AGE-2278 (ruling 21404) lets a company add an API key for Claude, Codex or Grok and place it in its model order beside the subscription sign-ins. The gateway image needs two changes for that.
https://api.x.ai/v1, next toopenai-apikeyandanthropic-apikey, with the xai sign-in row's lineup and wire metadata and no default model. Writing a company key onto thexairow itself would replace the Grok sign-ins throughallowKeyAuthOverride, so the key gets its own row.activeProviderEntriesnow lists every signed-in provider before any-apikeyprovider, androuteByKnownModelPatterngoes through it. Before this, a key written before the first sign-in came first in the config, so a bareclaude-*orgrok-*id went to the key. A key is now reached only through its own namespace (anthropic-apikey/...,openai-apikey/...,xai-apikey/...). AgentRadar's pinned requests already refused a key route; this closes the unpinned path.Version bumped to
.21.Tests
tests/routing/router.test.ts, AGE-2278 block:xai-apikey/<model>routes to the key with key auth.tests/providers/provider-registry-parity.test.tslistsxai-apikey.Lane run (
bun scripts/test.ts ./tests/providers ./tests/routing ./tests/lab ./tests/usage ./tests/oauth): 8031 pass, 6 fail. The same 6 fail on the baserelease/2.65.0-vadymhimself.15(grok-config-inject x3, grok-orphan-adoption, usage-summary custom windows, oauth-callback-server socket pin), so none is from this change.Eval added/updated: N/A deterministic (unit: tests/routing/router.test.ts)
Release
Tag
.21and the provisioner deploy are applied by the lead (infra). The paperclip half is a separate PR intodev; both are reviewed by qa-sec-8u.🤖 Generated with Claude Code