feat: add configurable provider endpoint for codex-api accounts

Add providerEndpoint field (responses/completions/auto) to openai-responses
accounts, allowing admins to specify which API endpoint format the provider
supports. The relay service normalizes request paths based on this config:
- responses (default): routes all requests to /v1/responses
- completions: routes all requests to /v1/chat/completions
- auto: preserves the original request path

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
X-Zero-L
2026-03-01 19:48:17 +08:00
parent 0871101f27
commit 0831739f4b
3 changed files with 60 additions and 4 deletions

View File

@@ -51,7 +51,8 @@ class OpenAIResponsesAccountService {
dailyQuota = 0, // 每日额度限制美元0表示不限制
quotaResetTime = '00:00', // 额度重置时间HH:mm格式
rateLimitDuration = 60, // 限流时间(分钟)
disableAutoProtection = false // 是否关闭自动防护429/401/400/529 不自动禁用)
disableAutoProtection = false, // 是否关闭自动防护429/401/400/529 不自动禁用)
providerEndpoint = 'responses' // Provider 端点类型responses | completions | auto
} = options
// 验证必填字段
@@ -96,7 +97,8 @@ class OpenAIResponsesAccountService {
lastResetDate: redis.getDateStringInTimezone(),
quotaResetTime,
quotaStoppedAt: '',
disableAutoProtection: disableAutoProtection.toString() // 关闭自动防护
disableAutoProtection: disableAutoProtection.toString(), // 关闭自动防护
providerEndpoint // Provider 端点类型responses(默认) | completions | auto
}
// 保存到 Redis