Repository navigation
Fix Claude Code gateway config helper #1745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
diegosouzapw
merged 2 commits into
cheaper-inference:release/v3.7.4
from
duncanleung:codex/fix-claude-code-gateway-config
Apr 28, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,10 @@ import { Card, Button, ModelSelectModal, ManualConfigModal } from "@/shared/comp | |||||
| import Image from "next/image"; | ||||||
| import CliStatusBadge from "./CliStatusBadge"; | ||||||
| import { useTranslations } from "next-intl"; | ||||||
| import { | ||||||
| getStoredClaudeAuthValue, | ||||||
| normalizeClaudeBaseUrl, | ||||||
| } from "@/shared/services/claudeCliConfig"; | ||||||
|
|
||||||
| const CLOUD_URL = process.env.NEXT_PUBLIC_CLOUD_URL; | ||||||
|
|
||||||
|
|
@@ -98,7 +102,7 @@ export default function ClaudeToolCard({ | |||||
| } | ||||||
| }); | ||||||
| // Restore selected key from file: match token stored in file against known keys | ||||||
| const tokenFromFile = env.ANTHROPIC_AUTH_TOKEN; | ||||||
| const tokenFromFile = getStoredClaudeAuthValue(env); | ||||||
| if (tokenFromFile) { | ||||||
| // (#523) Keys from /api/keys are masked (first 8 + "****" + last 4). | ||||||
| // Mask the token from file to compare against the masked list. | ||||||
|
|
@@ -124,12 +128,12 @@ export default function ClaudeToolCard({ | |||||
|
|
||||||
| const getEffectiveBaseUrl = () => { | ||||||
| const url = customBaseUrl || baseUrl; | ||||||
| return url.endsWith("/v1") ? url : `${url}/v1`; | ||||||
| return normalizeClaudeBaseUrl(url); | ||||||
| }; | ||||||
|
|
||||||
| const getDisplayUrl = () => { | ||||||
| const url = customBaseUrl || baseUrl; | ||||||
| return url.endsWith("/v1") ? url : `${url}/v1`; | ||||||
| return normalizeClaudeBaseUrl(url); | ||||||
| }; | ||||||
|
|
||||||
| const handleApplySettings = async () => { | ||||||
|
|
@@ -139,13 +143,9 @@ export default function ClaudeToolCard({ | |||||
| const env: any = { ANTHROPIC_BASE_URL: getEffectiveBaseUrl() }; | ||||||
|
|
||||||
| // (#523) Prefer keyId lookup so the backend writes the real key to disk. | ||||||
| // Fall back to sk_omniroute for localhost-only setups without a key. | ||||||
| // If no key is selected, leave auth unset so local installs can rely on | ||||||
| // anonymous access instead of persisting a fake placeholder token. | ||||||
| const selectedKeyId = selectedApiKey?.trim() || (apiKeys?.length > 0 ? apiKeys[0].id : null); | ||||||
| const skOmnirouteFallback = !cloudEnabled ? "sk_omniroute" : null; | ||||||
|
|
||||||
| if (!selectedKeyId && skOmnirouteFallback) { | ||||||
| env.ANTHROPIC_AUTH_TOKEN = skOmnirouteFallback; | ||||||
| } | ||||||
|
|
||||||
| tool.defaultModels.forEach((model) => { | ||||||
| const targetModel = modelMappings[model.alias] || model.defaultValue || ""; | ||||||
|
|
@@ -221,13 +221,13 @@ export default function ClaudeToolCard({ | |||||
|
|
||||||
| // Generate settings.json content for manual copy | ||||||
| const getManualConfigs = () => { | ||||||
| const keyToUse = | ||||||
| selectedApiKey && selectedApiKey.trim() | ||||||
| ? selectedApiKey | ||||||
| : !cloudEnabled | ||||||
| ? "sk_omniroute" | ||||||
| : "<API_KEY_FROM_DASHBOARD>"; | ||||||
| const env = { ANTHROPIC_BASE_URL: getEffectiveBaseUrl(), ANTHROPIC_AUTH_TOKEN: keyToUse }; | ||||||
| const env = { ANTHROPIC_BASE_URL: getEffectiveBaseUrl() }; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||
| if (selectedApiKey && selectedApiKey.trim()) { | ||||||
| env.ANTHROPIC_AUTH_TOKEN = "<API_KEY_FROM_DASHBOARD>"; | ||||||
| } else if (cloudEnabled) { | ||||||
| env.ANTHROPIC_AUTH_TOKEN = "<API_KEY_FROM_DASHBOARD>"; | ||||||
| } | ||||||
|
|
||||||
| tool.defaultModels.forEach((model) => { | ||||||
| const targetModel = modelMappings[model.alias]; | ||||||
| if (targetModel && model.envKey) env[model.envKey] = targetModel; | ||||||
|
|
@@ -443,7 +443,7 @@ export default function ClaudeToolCard({ | |||||
| </select> | ||||||
| ) : ( | ||||||
| <span className="flex-1 text-xs text-text-muted px-2 py-1.5"> | ||||||
| {cloudEnabled ? t("noApiKeysCreateOne") : t("defaultOmnirouteKey")} | ||||||
| {cloudEnabled ? t("noApiKeysCreateOne") : t("noApiKeysAvailable")} | ||||||
| </span> | ||||||
| )} | ||||||
| </div> | ||||||
|
|
||||||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
anybypasses TypeScript's type checking. Since this object is intended to store environment variable mappings (strings), it should be typed asRecord<string, string>.