Skip to content

18 feature add anthropic response api support - #19

Merged
chengzi404-hash merged 7 commits into
devfrom
18-feature-add-anthropic-response-api-support
Aug 16, 2026
Merged

18 feature add anthropic response api support#19
chengzi404-hash merged 7 commits into
devfrom
18-feature-add-anthropic-response-api-support

Conversation

@chengzi404-hash

Copy link
Copy Markdown
Collaborator

Issue: #18

Updated contribution guidelines to specify merging into the 'dev' branch instead of 'master'.
- Provider 新增 type 字段(openai/responses/anthropic),JSON 解析缺失或非法 type 时拒绝该 provider;Config.validate() 在活动 provider 被拒时给出明确 type 错误。
- use_preset() 把 type 写入生成的 provider 配置。
- stream_completion 按 provider.type 分发到三个后端:
  - openai: 原有 chat.completions.create 路径
  - responses: OpenAI SDK 的 responses 接口(system -> instructions,工具结果转 function_call_output)
  - anthropic: anthropic SDK 的 messages.stream(system 独立参数,必填 max_tokens)
- 统一 usage 归一化为 prompt_tokens/completion_tokens/total_tokens,ChatClient 透明累加。
- 现有 /openai 兼容预设(DeepSeek/GLM/Kimi/Qwen/MiniMax 等)补齐 type=openai;新增 anthropic 预设。
- requirements.txt 增加 anthropic 依赖。
- 配套测试:test_provider.py(type 解析/拒绝/use_preset 持久化/validate)、test_client.py(make_client 分发 + 三个后端的流事件解析)、test_ui.py(_setup_providers/_setup_preset 补 type 字段)。
在「多供应商与模型」章节加入 type 字段说明表(openai/responses/anthropic 三个取值对应的底层传输),并补 Anthropic provider 配置示例。
@github-actions github-actions Bot added the enhancement New feature or request label Aug 16, 2026
@chengzi404-hash
chengzi404-hash merged commit 5eb63aa into dev Aug 16, 2026
4 checks passed
@chengzi404-hash
chengzi404-hash deleted the 18-feature-add-anthropic-response-api-support branch August 16, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant