Commit Graph

16 Commits

Author SHA1 Message Date
1e0n
7d037a6e9a 现在官方会对ip地址进行限速,所以增加代理服务器功能 2025-10-24 12:34:21 +08:00
1e0n
62cdc11cec fix: apply model_redirects to /v1/messages/count_tokens endpoint 2025-10-14 02:35:59 +08:00
itzhan
597bce67c2 merge:增加对count_tokens的支持 2025-10-13 17:55:45 +08:00
Hwwwww
bf9fcfc928 新增模型重定向功能:在config.js中添加getRedirectedModelId函数以处理模型ID重定向,并在routes.js中更新相关请求处理逻辑以使用重定向后的模型ID。同时,在config.json中添加模型重定向配置示例。 2025-10-12 15:46:43 +08:00
itzhan
502922310c add claudecode count path 2025-10-09 19:19:06 +08:00
1e0n
27fdb7e157 修复 /v1/messages 端点 x-api-key 认证逻辑:
- handleDirectMessages 读取客户端 x-api-key header
- getAnthropicHeaders 优先使用客户端 x-api-key,避免同时设置 x-api-key 和 authorization
2025-10-09 15:05:30 +08:00
1e0n
4503604d04 支持Anthropic端点客户端x-api-key:\n- /v1/messages读取x-api-key并优先作为客户端授权传递\n- getAnthropicHeaders转发x-api-key并透传anthropic-version\n- CORS允许X-API-Key与anthropic-version 2025-10-09 14:58:56 +08:00
1e0n
bcdd524a34 升级到v1.3.1:为OpenAI端点的非流式 /v1/chat/completions 返回体转换为OpenAI兼容格式;保持Anthropic/Common非流式直传 2025-10-09 14:41:00 +08:00
1e0n
4a8d7986dd 升级到v1.3.0:新增auto推理模式和完善推理级别文档
主要功能更新:
- 新增auto推理级别,完全遵循客户端原始请求参数
- 支持五档推理级别:auto/off/low/medium/high
- auto模式零干预:不修改推理字段和anthropic-beta头
- 除gpt-5-codex外,所有模型默认设为auto模式

文档完善:
- 更新核心功能说明,突出智能推理级别控制
- 新增auto推理模式详细说明和使用场景
- 添加推理级别对比表格和配置示例
- 增强FAQ部分,分场景解答推理相关问题
- 提供OpenAI和Anthropic模型字段对应关系

技术实现:
- 更新getModelReasoning函数支持auto选项
- 完善所有transformer的auto模式处理逻辑
- 优化routes.js中直接转发端点的auto支持
- 确保auto模式下头信息和请求体完全透传
2025-10-09 13:32:50 +08:00
1e0n
1b1a25e68d 修复流式参数处理:尊重客户端明确指定的stream参数
- 修正transformers中强制添加stream=true的错误逻辑
- 只有客户端明确指定stream参数时才转发该参数
- 客户端未指定stream时不强制添加,保持原有意图
- 更新routes.js中相应的流式判断逻辑
- 确保非流式请求得到正确处理
2025-10-09 11:50:49 +08:00
1e0n
25f89a12b7 实现双授权系统:支持FACTORY_API_KEY环境变量优先级和客户端授权回退机制
- 新增FACTORY_API_KEY环境变量支持(最高优先级)
- 保留现有refresh token自动刷新机制
- 添加客户端authorization头作为fallback
- 优化启动流程,无认证配置时不报错退出
- 更新所有端点支持新的授权优先级系统
- 修改GPT-5-Codex推理级别为off
2025-10-08 19:42:39 +08:00
1e0n
1c29062ba7 增加大模型推理级别配置 2025-10-08 05:26:31 +08:00
1e0n
43803ca9da Add common endpoint support and system prompt injection, v1.1.0
- Add common endpoint type for GLM-4.6 model
- Implement automatic system prompt injection for all requests
- Simplify README documentation for better user focus
- Update version to 1.1.0
- Add *.txt to .gitignore

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-10-07 21:06:28 +08:00
1e0n
4d5ce26e7f Add /v1/messages endpoint for direct Anthropic forwarding
Features:
- Add new /v1/messages endpoint for transparent Anthropic request/response forwarding
- Only supports anthropic type endpoints (rejects openai with 400 error)
- No request transformation - forwards original request body as-is
- No response transformation - streams and non-streaming responses forwarded directly

Now supports three endpoint patterns:
- /v1/chat/completions: Universal with format conversion (anthropic, openai)
- /v1/responses: Direct proxy for openai endpoints only
- /v1/messages: Direct proxy for anthropic endpoints only
2025-10-07 05:26:57 +08:00
1e0n
79616ba3b9 Add /v1/responses endpoint for direct OpenAI forwarding
Features:
- Add new /v1/responses endpoint for transparent request/response forwarding
- Only supports openai type endpoints (rejects anthropic with 400 error)
- No request transformation - forwards original request body as-is
- No response transformation - streams and non-streaming responses forwarded directly
- /v1/chat/completions keeps original behavior with format conversion

Differences between endpoints:
- /v1/chat/completions: Converts formats for all endpoint types (anthropic, openai)
- /v1/responses: Direct proxy for openai endpoints only, zero transformation
2025-10-07 05:14:58 +08:00
1e0n
6dca025e96 Initial commit: OpenAI compatible API proxy with auto token refresh
- Implemented OpenAI compatible API proxy server
- Support for Anthropic and custom OpenAI format conversion
- Automatic API key refresh with WorkOS OAuth
- SSE streaming response transformation
- Smart header management for Factory endpoints
- Chinese documentation
2025-10-06 02:12:01 +08:00