Skip to content

Add Anthropic (Claude) as a model provider#21

Merged
MagicCube merged 5 commits intoMagicCube:mainfrom
hannah-15:dev
Apr 11, 2026
Merged

Add Anthropic (Claude) as a model provider#21
MagicCube merged 5 commits intoMagicCube:mainfrom
hannah-15:dev

Conversation

@hannah-15
Copy link
Copy Markdown
Contributor

Screenshot 2026-04-09 at 17 47 55

Implement support for Anthropic API alongside the existing OpenAI provider:

  • Add @anthropic-ai/sdk dependency
  • Extend config schema with provider field ("openai" or "anthropic")
  • Add Anthropic to MODEL_PROVIDERS list with default baseURL
  • Update model wizard to capture and pass provider type
  • Update CLI to branch on provider type and instantiate AnthropicModelProvider
    or OpenAIModelProvider accordingly

Implement AnthropicModelProvider with:

  • Message conversion handling system prompts as separate parameter
  • Tool conversion mapping to input_schema format
  • Response parsing for text, thinking, and tool_use content blocks
  • Thinking block signature preservation for multi-turn conversations
  • Token usage normalization

@MagicCube
Copy link
Copy Markdown
Owner

MagicCube commented Apr 10, 2026

Hi @hannah-15, thanks so much for your contribution. And YES! We love Anthropic!

However I just added a new *stream() method to the ModelProvider's interface this morning, as well as a new property named streaming?: boolean in the AssistantMessage interface. And I also found that there're also some lint issues in your PR need to be improved as well.

Please refer to a985f67

Would you please kindly implement the *stream() feature and fix all the linting/testing issues? Looking forward to your reply.

Thanks again!

@hannah-15 hannah-15 force-pushed the dev branch 2 times, most recently from e094556 to f88e123 Compare April 10, 2026 04:37
@hannah-15
Copy link
Copy Markdown
Contributor Author

Hi @MagicCube, thanks for the comment! I've just pushed an update that addresses both points.

  1. stream() implementation for AnthropicModelProvider
  2. All bun run check steps now pass cleanly (tsc --noEmit, eslint, and bun test)

Let me know if any further issue!

Hi @hannah-15, thanks so much for your contribution. And YES! We love Anthropic!

However I just added a new *stream() method to the ModelProvider's interface this morning, as well as a new property named streaming?: boolean in the AssistantMessage interface. And I also found that there're also some lint issues in your PR need to be improved as well.

Please refer to a985f67

Would you please kindly implement the *stream() feature and fix all the linting/testing issues? Looking forward to your reply.

Thanks again!

@hannah-15
Copy link
Copy Markdown
Contributor Author

Hi @MagicCube, the check workflow needs your approval. Can you kindly trigger it when you review the code? Thanks!
image

@MagicCube MagicCube merged commit 9a855cf into MagicCube:main Apr 11, 2026
1 check failed
@MagicCube
Copy link
Copy Markdown
Owner

Nice job, @hannah-15! It's a good start as your ver first PR on GitHub.

@hannah-15
Copy link
Copy Markdown
Contributor Author

Thanks @MagicCube, it's my pleasure to make contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants