- 05 Feb, 2026 10 commits
-
-
shaw authored
-
shaw authored
-
Wesley Liddick authored
feat(gateway): filter /v1/usage stats by API Key instead of UserID
-
Wesley Liddick authored
feat: add support for HTTP/2 Cleartext (h2c) connections
-
Lemon authored
-
Lemon authored
-
shaw authored
- 新增 Access Token + Refresh Token 双令牌认证 - 支持 Token 自动刷新和轮转 - 添加登出和撤销所有会话接口 - 前端实现无感刷新和主动刷新定时器
-
JIA-ss authored
Previously the /v1/usage endpoint aggregated usage stats (today/total tokens, cost, RPM/TPM) across all API Keys belonging to the user. This made it impossible to distinguish usage from different API Keys (e.g. balance vs subscription keys). Now the usage stats are filtered by the current request's API Key ID, so each key only sees its own usage data. The balance/remaining fields are unaffected and still reflect the user-level wallet balance. Changes: - Add GetAPIKeyDashboardStats to repository interface and implementation - Add getPerformanceStatsByAPIKey helper (also fixes TPM to include cache_creation_tokens and cache_read_tokens) - Add GetAPIKeyDashboardStats to UsageService - Update Usage handler to call GetAPIKeyDashboardStats(apiKey.ID) Co-Authored-By:Claude Opus 4.5 <noreply@anthropic.com>
-
shaw authored
未知工具名不再进行 PascalCase/snake_case 转换,保持原样透传。 修复 text_editor_20250728 等 Anthropic 特殊工具被错误转换的问题。
-
Wesley Liddick authored
fix: remove unsupported safety_identifier and previous_response_id fields from upstream requests
-
- 04 Feb, 2026 5 commits
-
-
Lemon authored
-
shaw authored
问题:normalizeClaudeModelForAnthropic 函数错误地将长模型ID截断为短ID, 导致 APIKey 账号的模型名被错误修改。 修复: - 删除错误的 normalizeClaudeModelForAnthropic 函数和 anthropicPrefixMappings 变量 - 直接使用 claude.NormalizeModelID(正确的短ID->长ID扩展) - APIKey 账号无显式映射时透传原始模型名
-
Wesley Liddick authored
fix(gemini): 优化 Gemini 接口认证兼容性,支持 Authorization: Bearer
-
柴叁 authored
调整 API key 提取优先级,让 /v1beta 接口同时支持 x-goog-api-key 和 Authorization: Bearer 两种认证方式,解决 OpenClaw 等使用 Bearer 认证 的客户端无法直接访问 Gemini 接口的问题。
-
Payne Fu authored
Co-Authored-By:Claude Opus 4.5 <noreply@anthropic.com>
-
- 03 Feb, 2026 25 commits
-
-
Wesley Liddick authored
fix(api): 修复 thinking 块被意外修改导致的 400 错误
-
Wesley Liddick authored
fix(gemini): 导出 DummyThoughtSignature 常量并修复跨账号签名验证
-
Wesley Liddick authored
fix(openai): 统一 OAuth instructions 处理逻辑,修复 Codex CLI 400 错误
-
shaw authored
-
Wesley Liddick authored
Antigravity 相关BUG修复及调度优化
-
Wesley Liddick authored
-
liuxiongfeng authored
- 将 dummyThoughtSignature 改为导出的 DummyThoughtSignature 常量,供跨包使用 - 修改 gemini_native_signature_cleaner.go 将删除签名改为替换为 dummy 签名 这样可以跳过 Gemini 3 的签名验证,解决粘性会话切换账号时的验证失败问题 - 更新相关测试文件 Fixes: 粘性会话切换账号时 thoughtSignature 验证失败导致 400 错误
-
liuxiongfeng authored
- 修改 applyCodexOAuthTransform 函数签名,增加 isCodexCLI 参数 - 移除 && !isCodexCLI 条件,对所有 OAuth 请求统一处理 - 新增 applyInstructions/applyCodexCLIInstructions/applyOpenCodeInstructions 辅助函数 - 新增 isInstructionsEmpty 函数检查 instructions 字段是否为空 - 添加 Codex CLI 和非 Codex CLI 场景的测试用例 逻辑说明: - Codex CLI + 有 instructions: 保持不变 - Codex CLI + 无 instructions: 补充 opencode 指令 - 非 Codex CLI: 使用 opencode 指令覆盖
-
Wesley Liddick authored
feat(api-key): 添加API密钥独立配额和过期时间功能
-
bayma888 authored
-
bayma888 authored
Add quota, quota_used, expires_at fields to expected JSON responses in POST /api/v1/keys and GET /api/v1/keys test cases.
-
Wesley Liddick authored
fix(proxy): 增加代理探测的多 URL 回退机制
-
bayma888 authored
- Add missing IncrementQuotaUsed method to stubApiKeyRepo in api_contract_test.go - Fix gofmt formatting issues in api_key_service.go, dto/types.go, api_key_handler.go
-
Wesley Liddick authored
feat(admin): 管理员可查看每个用户充值和并发变动记录、点击余额可直接查看、优化弹框UI
-
bayma888 authored
Add the missing IncrementQuotaUsed method to: - fakeAPIKeyRepo (api_key_auth_google_test.go) - stubApiKeyRepo (api_key_auth_test.go) - apiKeyRepoStub (api_key_service_delete_test.go) - authRepoStub (api_key_service_cache_test.go)
-
bayma888 authored
This feature allows API Keys to have their own quota limits and expiration times, independent of the user's balance. Backend: - Add quota, quota_used, expires_at fields to api_key schema - Implement IsExpired() and IsQuotaExhausted() checks in middleware - Add ResetQuota and ClearExpiration API endpoints - Integrate quota billing in gateway handlers (OpenAI, Anthropic, Gemini) - Include quota/expiration fields in auth cache for performance - Expiration check returns 403, quota exhausted returns 429 Frontend: - Add quota and expiration inputs to key create/edit dialog - Add quick-select buttons for expiration (+7, +30, +90 days) - Add reset quota confirmation dialog - Add expires_at column to keys list - Add i18n translations for new features (en/zh) Migration: - Add 045_add_api_key_quota.sql for new columns
-
bayma888 authored
Add ListByUserPaginated and SumPositiveBalanceByUser methods
-
bayma888 authored
Add ListByUserPaginated and SumPositiveBalanceByUser to redeemRepoStub Add GetUserBalanceHistory to stubAdminService Fixes CI test compilation errors
-
JIA-ss authored
某些 AI API 专用代理只允许访问特定域名(如 anthropic.com、openai.com), 会拦截对 ip-api.com 的请求。本次修改增加了多 URL 回退机制: 1. 优先使用 ip-api.com(可获取详细地理信息:城市、地区、国家) 2. 若失败则回退到 httpbin.org/ip(仅获取 IP 地址,速度快) 主要变更: - 新增 probeURLs 列表支持多个探测 URL - 重构 ProbeProxy() 实现回退逻辑 - 新增 parseHTTPBin() 解析 httpbin.org 响应 - 优化错误信息,JSON 解析失败时显示响应体前 200 字符 Co-Authored-By:Claude <noreply@anthropic.com>
-
song authored
-
song authored
-
song authored
-
song authored
-
song authored
-
JIA-ss authored
问题描述: 使用扩展思考功能时,偶现以下错误: "thinking or redacted_thinking blocks in the latest assistant message cannot be modified" 根因分析: 当代理服务修改请求体中的某些字段时(如 metadata.user_id、model), 使用 map[string]any 解析整个 JSON 后重新序列化,导致: 1. 字段顺序改变(Go map 序列化按字母排序) 2. 数字格式变化(如 1.0 → 1) 3. Unicode 转义变化 Claude API 对 thinking 块进行字节级验证,任何变化都会触发错误。 修复内容: 1. identity_service.go - RewriteUserID/RewriteUserIDWithMasking 使用 json.RawMessage 保留其他字段的原始字节 2. gateway_service.go - replaceModelInBody 使用 json.RawMessage 保留其他字段的原始字节 3. gateway_service.go - normalizeClaudeOAuthRequestBody 保留 messages 的原始字节,跳过包含 thinking 块的消息修改 4. gateway_service.go - isThinkingBlockSignatureError 添加 "cannot be modified" 错误检测,触发自动重试 5. antigravity_gateway_service.go - isSignatureRelatedError 添加 "cannot be modified" 错误检测 Co-Authored-By:Claude Opus 4.5 <noreply@anthropic.com>
-