diff --git a/frontend/src/components/api-key-config-modal/client.ts b/frontend/src/components/api-key-config-modal/client.ts
index 7817a99a1..0fa7522da 100644
--- a/frontend/src/components/api-key-config-modal/client.ts
+++ b/frontend/src/components/api-key-config-modal/client.ts
@@ -1,20 +1,25 @@
+import type { BuiltinProvider } from '@/providers/catalog'
import { API_BASE_URL } from '@/api/constants'
-const CODEX_DEFAULT_MODEL = 'gpt-5.6-terra'
-export const CODEX_WEBSOCKET_ENABLED_BY_DEFAULT = false
+const clientPresets = {
+ openai: { app: 'codex', model: 'gpt-6-luna' },
+ xai: { app: 'grokbuild', model: 'grok-4.7' },
+ antigravity: { app: 'agy', model: 'Gemini 4 Neon (High)' },
+} satisfies Record
-interface CodexConfigInput {
+interface SetupInput {
+ provider: BuiltinProvider
apiKey: string
- baseUrl: string
- websocketEnabled?: boolean
+ root: string
+ windows: boolean
+ websocketEnabled: boolean
}
-export function buildCodexConfig(input: CodexConfigInput): string {
- const baseUrl = input.baseUrl.replace(/\/+$/, '')
- const websocketEnabled = input.websocketEnabled ?? CODEX_WEBSOCKET_ENABLED_BY_DEFAULT
+function buildCodexConfig(apiKey: string, baseUrl: string, websocketEnabled: boolean) {
+ const model = JSON.stringify(clientPresets.openai.model)
return `model_provider = "OpenAI"
-model = "${CODEX_DEFAULT_MODEL}"
-review_model = "${CODEX_DEFAULT_MODEL}"
+model = ${model}
+review_model = ${model}
model_reasoning_effort = "max"
service_tier = "default"
# 语音通话控制地址
@@ -28,7 +33,7 @@ wire_api = "responses"
supports_websockets = ${websocketEnabled}
requires_openai_auth = false
# 代理密钥
-experimental_bearer_token = ${JSON.stringify(input.apiKey)}
+experimental_bearer_token = ${JSON.stringify(apiKey)}
[model_providers.OpenAI.capabilities]
# V2 远程压缩
@@ -45,9 +50,47 @@ image_generation = true
goals = true`
}
-interface CodexCcSwitchImportInput {
+export function buildClientConfig({ provider, root, apiKey, windows, websocketEnabled }: SetupInput) {
+ const path = (relative: string) => windows
+ ? `%USERPROFILE%\\${relative.replaceAll('/', '\\')}`
+ : `~/${relative}`
+ const baseUrl = `${root}/v1`
+ if (provider === 'openai') {
+ return {
+ title: path('.codex/config.toml'),
+ text: buildCodexConfig(apiKey, baseUrl, websocketEnabled),
+ }
+ }
+ if (provider === 'xai') {
+ return {
+ title: path('.grok/config.toml'),
+ text: `[models]
+default = "cpr"
+
+[model.cpr]
+model = ${JSON.stringify(clientPresets.xai.model)}
+base_url = ${JSON.stringify(baseUrl)}
+api_key = ${JSON.stringify(apiKey)}
+api_backend = "responses"`,
+ }
+ }
+
+ return {
+ title: path('.gemini/config/config.json'),
+ text: JSON.stringify({
+ gateway: {
+ enabled: true,
+ url: root,
+ wireProtocol: 'genai',
+ apiKey,
+ },
+ }, null, 2),
+ }
+}
+
+interface CcSwitchImportInput {
+ provider: BuiltinProvider
apiKey: string
- baseUrl: string
providerName: string
}
@@ -84,16 +127,20 @@ function buildUsageScript(apiKey: string, baseUrl: string) {
})`
}
-export function buildCodexCcSwitchImportDeeplink(input: CodexCcSwitchImportInput): string {
- const baseUrl = input.baseUrl.replace(/\/+$/, '')
+export function buildCcSwitchImportDeeplink(input: CcSwitchImportInput): string {
+ const root = resolveServiceRootUrl()
+ const baseUrl = `${root}/v1`
+ const endpoint = input.provider === 'antigravity'
+ ? root
+ : baseUrl
// 导入端会重建 Codex 配置,只传连接信息和用量查询,不传无法保留的完整模板
const entries: [string, string][] = [
['resource', 'provider'],
- ['app', 'codex'],
- ['model', CODEX_DEFAULT_MODEL],
+ ['app', clientPresets[input.provider].app],
+ ['model', clientPresets[input.provider].model],
['name', input.providerName],
- ['homepage', baseUrl],
- ['endpoint', baseUrl],
+ ['homepage', root],
+ ['endpoint', endpoint],
['apiKey', input.apiKey],
['usageEnabled', 'true'],
[
diff --git a/frontend/src/components/api-key-config-modal/index.vue b/frontend/src/components/api-key-config-modal/index.vue
index 660890080..d93396197 100644
--- a/frontend/src/components/api-key-config-modal/index.vue
+++ b/frontend/src/components/api-key-config-modal/index.vue
@@ -1,120 +1,78 @@
-
-
-
-
-
+
+
+
-
-
-
-
- {{ configPath }}
-
-
-
-
-
-
-
-
+
+
+
+
+ {{ config.title }}
+
+
+
+
+
+
-
-
-
- {{ t('keys.configuration.importTo') }}
+
+ {{ t('keys.configuration.importTo') }}
{{ t('common.actions.close') }}
-
+
diff --git a/frontend/src/i18n/locales/en/keys.json b/frontend/src/i18n/locales/en/keys.json
index f97c0f3ab..c25750ea5 100644
--- a/frontend/src/i18n/locales/en/keys.json
+++ b/frontend/src/i18n/locales/en/keys.json
@@ -1,15 +1,15 @@
{
"keys": {
"configuration": {
- "description": "Save or merge the configuration below and then restart Codex",
"platform": "Platform",
"toggleWebSocket": "Switch WebSocket configuration",
+ "fullApiKeyNotAvailable": "Full API key not available",
+ "title": "Use API key",
+ "os": "Operating system",
"importTo": "Import",
"selectImportTool": "Choose a tool to import into",
"ccSwitchDescription": "Manage AI client configurations",
- "viewOnGitHub": "View {name} on GitHub",
- "fullApiKeyNotAvailable": "Full API key not available",
- "title": "Use API key"
+ "viewOnGitHub": "View {name} on GitHub"
},
"actions": {
"editKey": "Edit key",
diff --git a/frontend/src/i18n/locales/zh-Hans/keys.json b/frontend/src/i18n/locales/zh-Hans/keys.json
index fcefea71d..0257378d6 100644
--- a/frontend/src/i18n/locales/zh-Hans/keys.json
+++ b/frontend/src/i18n/locales/zh-Hans/keys.json
@@ -1,15 +1,15 @@
{
"keys": {
"configuration": {
- "description": "保存或合并下方配置后重启 Codex",
- "platform": "配置平台",
+ "platform": "平台",
"toggleWebSocket": "切换 WebSocket 配置",
+ "fullApiKeyNotAvailable": "完整 API密钥不可用",
+ "title": "使用密钥",
+ "os": "操作系统",
"importTo": "导入到",
"selectImportTool": "选择要导入的工具",
"ccSwitchDescription": "管理和切换 AI 客户端配置",
- "viewOnGitHub": "在 GitHub 查看 {name}",
- "fullApiKeyNotAvailable": "完整 API密钥不可用",
- "title": "使用密钥"
+ "viewOnGitHub": "在 GitHub 查看 {name}"
},
"actions": {
"editKey": "编辑密钥",
diff --git a/frontend/src/i18n/locales/zh-Hant/keys.json b/frontend/src/i18n/locales/zh-Hant/keys.json
index 1a21a9182..847b5a037 100644
--- a/frontend/src/i18n/locales/zh-Hant/keys.json
+++ b/frontend/src/i18n/locales/zh-Hant/keys.json
@@ -1,15 +1,15 @@
{
"keys": {
"configuration": {
- "description": "保存或合併下方配置後重啓 Codex",
- "platform": "配置平臺",
+ "platform": "平台",
"toggleWebSocket": "切換 WebSocket 配置",
+ "fullApiKeyNotAvailable": "完整 API密鑰不可用",
+ "title": "使用密鑰",
+ "os": "作業系統",
"importTo": "導入到",
"selectImportTool": "選擇要導入的工具",
"ccSwitchDescription": "管理和切換 AI 客戶端配置",
- "viewOnGitHub": "在 GitHub 查看 {name}",
- "fullApiKeyNotAvailable": "完整 API密鑰不可用",
- "title": "使用密鑰"
+ "viewOnGitHub": "在 GitHub 查看 {name}"
},
"actions": {
"editKey": "編輯密鑰",
diff --git a/frontend/src/providers/catalog.ts b/frontend/src/providers/catalog.ts
index ba976b7f4..828d5be56 100644
--- a/frontend/src/providers/catalog.ts
+++ b/frontend/src/providers/catalog.ts
@@ -5,8 +5,8 @@ import { t } from '@/i18n'
const providers = {
openai: { label: 'OpenAI', icon: Openai },
- xai: { label: 'xAI', icon: Xai },
antigravity: { label: 'Antigravity', icon: GoogleAntigravity },
+ xai: { label: 'xAI', icon: Xai },
} as const
export const PROVIDER_IDS = Object.keys(providers) as BuiltinProvider[]
diff --git a/frontend/src/views/accounts/components/AccountConnectionTestModal.vue b/frontend/src/views/accounts/components/AccountConnectionTestModal.vue
index 24618add6..81672db43 100644
--- a/frontend/src/views/accounts/components/AccountConnectionTestModal.vue
+++ b/frontend/src/views/accounts/components/AccountConnectionTestModal.vue
@@ -95,6 +95,7 @@ function connectionLogClass(tone: string) {
Boolean(props.account.planType) || props.account.authenticationKind === 'api_key')
-const hasForecast = computed(() => props.account.authenticationKind !== 'api_key')
+// Antigravity 的额度按模型组返回,不能用于整号周/月预测。
+const hasForecast = computed(() => props.account.provider !== 'antigravity' && props.account.authenticationKind !== 'api_key')
const hasPersonalInfo = computed(() => props.account.capabilities.profile || props.account.capabilities.subscription)
const needsPeerDiscovery = computed(() => props.account.upstream?.discovered === false)
const canRefresh = computed(() => props.account.capabilities.quotaRefresh || props.account.upstream != null)
diff --git a/frontend/src/views/accounts/components/account-quota-summary-cell/index.vue b/frontend/src/views/accounts/components/account-quota-summary-cell/index.vue
index f7b49cd43..72c828cad 100644
--- a/frontend/src/views/accounts/components/account-quota-summary-cell/index.vue
+++ b/frontend/src/views/accounts/components/account-quota-summary-cell/index.vue
@@ -109,7 +109,7 @@ const additionalEntryCount = computed(() => Math.max(summaryEntries.value.length
+{{ additionalEntryCount }}
diff --git a/frontend/src/views/accounts/composables/useAccountConnectionTest.ts b/frontend/src/views/accounts/composables/useAccountConnectionTest.ts
index 1694dc4fe..345279d7e 100644
--- a/frontend/src/views/accounts/composables/useAccountConnectionTest.ts
+++ b/frontend/src/views/accounts/composables/useAccountConnectionTest.ts
@@ -1,3 +1,4 @@
+import type { SelectOption } from '@codex-proxy/ui'
import type { Account, AccountModelsResponse } from '@/api'
import { CheckCircle2, Clock3, Wifi, XCircle } from '@lucide/vue'
import { useEventSource } from '@vueuse/core'
@@ -14,11 +15,6 @@ import { errorMessage } from '@/utils/operation'
type ConnectionTestStatus = 'idle' | 'running' | 'success' | 'error'
type ConnectionTestLogTone = 'normal' | 'info' | 'success' | 'danger'
-interface ConnectionTestModelOption {
- label: string
- value: string
-}
-
interface ConnectionTestLog {
key: string
time: string
@@ -179,7 +175,7 @@ export function useAccountConnectionTest(options: { reload: () => Promise modelsRequest.loading.value && modelsRequestMode.value === 'load')
const refreshingConnectionTestModels = computed(() => modelsRequest.loading.value && modelsRequestMode.value === 'refresh')
const connectionTestSelectedModel = shallowRef('')
- const connectionTestModelOptions = ref([])
+ const connectionTestModelOptions = ref([])
const connectionTestStreamUrl = shallowRef()
const {
data: connectionTestStreamMessage,
@@ -452,7 +448,13 @@ export function useAccountConnectionTest(options: { reload: () => Promise ({ value, label }))
+ connectionTestModelOptions.value = Array.from(labels, ([value, label]) => ({
+ value,
+ label,
+ description: value === label
+ ? undefined
+ : value,
+ }))
connectionTestSelectedModel.value = labels.has(previousSelection)
? previousSelection
: connectionTestModelOptions.value[0]?.value || ''
diff --git a/frontend/src/views/key-usage/composables/useKeyConfig.ts b/frontend/src/views/key-usage/composables/useKeyConfig.ts
index 9bfa626cc..49b0e0bb8 100644
--- a/frontend/src/views/key-usage/composables/useKeyConfig.ts
+++ b/frontend/src/views/key-usage/composables/useKeyConfig.ts
@@ -1,6 +1,5 @@
-import { computed, onScopeDispose, shallowRef } from 'vue'
+import { onScopeDispose, shallowRef } from 'vue'
import { getKeyUsageConfig } from '@/api'
-import { resolveServiceRootUrl } from '@/components/api-key-config-modal/client'
import { useCopyText } from '@/composables/useCopyText'
import { useRequestState } from '@/composables/useRequestState'
@@ -9,7 +8,6 @@ export function useKeyConfig() {
const configKey = shallowRef<{ name: string, key: string } | null>(null)
const request = useRequestState()
const copyText = useCopyText()
- const apiBaseUrl = computed(() => `${resolveServiceRootUrl()}/v1`)
async function openConfig() {
if (request.loading.value)
@@ -45,7 +43,6 @@ export function useKeyConfig() {
showConfig,
configKey,
configuring: request.loading,
- apiBaseUrl,
openConfig,
copyConfig,
}
diff --git a/frontend/src/views/key-usage/index.vue b/frontend/src/views/key-usage/index.vue
index d4ec6f6ff..ab4c69ede 100644
--- a/frontend/src/views/key-usage/index.vue
+++ b/frontend/src/views/key-usage/index.vue
@@ -17,7 +17,7 @@ const { t } = useI18n({ useScope: 'global' })
const { period, model, kind, refreshInterval, overview, overviewLoading, refreshing, records, refresh, changePageSize, changePage } = useKeyUsage()
const { items, currentPage, pageSize, total, loading: recordsLoading } = records
-const { showConfig, configKey, configuring, apiBaseUrl, openConfig, copyConfig } = useKeyConfig()
+const { showConfig, configKey, configuring, openConfig, copyConfig } = useKeyConfig()
@@ -49,6 +49,6 @@ const { showConfig, configKey, configuring, apiBaseUrl, openConfig, copyConfig }
-
+
diff --git a/frontend/src/views/keys/components/ApiKeyCreatedModal.vue b/frontend/src/views/keys/components/ApiKeyCreatedModal.vue
index d26c4139b..640b4b31a 100644
--- a/frontend/src/views/keys/components/ApiKeyCreatedModal.vue
+++ b/frontend/src/views/keys/components/ApiKeyCreatedModal.vue
@@ -1,4 +1,5 @@