Skip to content

add anthropic provider#29

Merged
qduc merged 8 commits intomainfrom
claude/add-anthropic-provider-01RycAcSDVxJj6zWtHCWCpMr
Nov 23, 2025
Merged

add anthropic provider#29
qduc merged 8 commits intomainfrom
claude/add-anthropic-provider-01RycAcSDVxJj6zWtHCWCpMr

Conversation

@qduc
Copy link
Copy Markdown
Owner

@qduc qduc commented Nov 23, 2025

No description provided.

claude and others added 8 commits November 23, 2025 10:25
Add complete Anthropic provider implementation with the following features:

- MessagesAdapter: Translates between internal format and Anthropic Messages API
  - Converts OpenAI-style messages to Anthropic format
  - Handles system prompts as top-level parameter
  - Converts tool specifications to Anthropic input_schema format
  - Supports multimodal content (text and images)
  - Streams responses with SSE event handling
  - Converts Anthropic responses back to OpenAI-compatible format

- AnthropicProvider: Manages API communication with Anthropic
  - Authentication via x-api-key header
  - Anthropic API version header support
  - Upstream request/response logging
  - Tool support with automatic schema conversion
  - Prompt caching support
  - Default model: claude-3-5-sonnet-20241022

Implementation follows existing provider patterns and maintains OpenAI API compatibility.
Add unit tests for the MessagesAdapter covering:
- OpenAI to Anthropic message format conversion
- System message extraction and combination
- Tool specification conversion
- Tool use and tool result handling
- Multimodal content conversion
- Streaming event translation
- Default model handling
- Error cases

All 15 tests pass successfully.
Add UI support for Anthropic provider configuration:
- Add 'Anthropic' option to Provider Type dropdown
- Conditionally hide Base URL field for non-OpenAI providers
- Update helper text based on selected provider type
- Add provider-specific API key placeholder (sk-ant-api03-... for Anthropic)

The Base URL field now only appears when 'OpenAI Compatible' is selected,
as Anthropic provider uses a fixed endpoint (https://api.anthropic.com).
@qduc qduc merged commit ead4b11 into main Nov 23, 2025
3 checks passed
@qduc qduc deleted the claude/add-anthropic-provider-01RycAcSDVxJj6zWtHCWCpMr branch November 29, 2025 12:59
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