Anthropic
Claude Sonnet 4 API
Claude Sonnet 4 is the workhorse of the Claude 4 family — strong reasoning, fast latency, and 5× cheaper than Opus. It has a 200K context window, supports vision, and is the recommended default for most production workloads.
- Input
- $3.00
- Output
- $15.00
- Context
- 200K
- Vision
- Yes
/ 1M tokens
/ 1M tokens
tokens
Top use cases
- Production chat and customer support
- Code generation and review at scale
- Document summarization and Q&A
- RAG-backed knowledge assistants
- Most agentic workflows
Use Claude Sonnet 4 in 30 seconds
ModelServer is OpenAI-compatible. Point your existing OpenAI SDK at modelserver.dev/v1 and set the model name to claude-sonnet-4.
claude-sonnet-4.py
from openai import OpenAI
client = OpenAI(
api_key="sk-modelserver-...",
base_url="https://modelserver.dev/v1",
)
response = client.chat.completions.create(
model="claude-sonnet-4",
messages=[
{"role": "user", "content": "Hello, Claude Sonnet 4!"}
],
)
print(response.choices[0].message.content)Frequently asked questions
- How much does Claude Sonnet 4 cost?
- Claude Sonnet 4 is priced at $3.00 per 1M input tokens and $15.00 per 1M output tokens via ModelServer. ModelServer adds a flat 5.5% platform fee on top — no markups on individual tokens, no monthly minimum.
- What is the Claude Sonnet 4 context window?
- Claude Sonnet 4 supports a 200K token context window. You can put roughly 150,000 words in a single prompt.
- Is Claude Sonnet 4 OpenAI-compatible via ModelServer?
- Yes. Point your OpenAI SDK base_url to https://modelserver.dev/v1 and set model="claude-sonnet-4". Existing OpenAI-SDK code works without modification.
- Who is Claude Sonnet 4 best for?
- The default Claude — pick this unless you have a specific reason not to.
- Does Claude Sonnet 4 support vision input?
- Yes. Claude Sonnet 4 accepts image inputs alongside text. Pass images as base64 or URL in the OpenAI-compatible message format.