How do I call claude-sonnet-4 from my code?
Use the OpenAI or Anthropic SDK and point baseURL at https://synapse.garden/api/v1. Set model: ‘anthropic/claude-sonnet-4’ and supply your Synapse Garden API key. No code changes beyond the base URL.
anthropic/claude-sonnet-4 idClaude Sonnet 4 significantly improves on Sonnet 3.7's industry-leading capabilities, excelling in coding with a state-of-the-art 72.7% on SWE-bench. The model balances performance and efficiency for internal and external use cases, with enhanced steerability for greater control over implementations. While not matching Opus 4 in most domains, it delivers an optimal mix of capability and practicality.
# Drop-in OpenAI-compatible client$ import { generateText } from 'ai'$$ const { text } = await generateText({$ model: 'anthropic/claude-sonnet-4',$ baseURL: 'https://synapse.garden/api/v1',$ apiKey: process.env.MG_KEY,$ prompt: 'Why is the sky blue?',$ })
| Rate | Per million tokens · USD |
|---|---|
| Input | $3.30/M |
| Output | $16.50/M |
| Cache read | $0.330/M |
| Cache write | $4.13/M |
Use the OpenAI or Anthropic SDK and point baseURL at https://synapse.garden/api/v1. Set model: ‘anthropic/claude-sonnet-4’ and supply your Synapse Garden API key. No code changes beyond the base URL.
Input: $3.30/M per million tokens. Output: $16.50/M per million tokens. The free tier includes a million tokens every month at no cost.
claude-sonnet-4 supports a context window of 1M tokens, with a maximum output of 64K tokens.
No. Synapse Garden is the single API surface — one key gives you OpenAI, Anthropic, Google, Meta, Mistral, DeepSeek, xAI, Cohere, and more. Billing, rate limits, and audit logs are unified.
Sign up, create a key, drop our base URL into your existing client. The free tier includes a million tokens every month — no credit card.