Skip to content

Anthropic

VariableRequired
ANTHROPIC_API_KEYYes
Terminal window
curl -X POST http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "anthropic/claude-sonnet-4-20250514", "messages": [{"role": "user", "content": "Hello!"}]}'
use llmg_providers::anthropic::AnthropicClient;
use llmg_core::provider::Provider;
let client = AnthropicClient::from_env()?;
// or
let client = AnthropicClient::new("sk-ant-...");
  • Chat completions (auto-converts to Anthropic format)
  • Custom base URL
  • Anthropic API version header

LLMG automatically converts between the OpenAI message format and Anthropic’s native format. System messages are extracted and sent via the system parameter.