Developer integration
Using Claude models
Yomi API offers Claude models through both OpenAI-compatible and native Anthropic formats. Choose the format that fits your existing stack.
Available models
| Model ID | Context | Positioning |
|---|---|---|
claude-opus-4-8 | 200K | Top-tier reasoning for long documents and complex agents |
claude-sonnet-5 | 1M | Balances speed and intelligence for production agents |
OpenAI-compatible calls
Keep using the OpenAI SDK and /v1/chat/completions; change only the model parameter:
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.yomiapi.com/v1"
)
response = client.chat.completions.create(
model="claude-sonnet-5",
messages=[{"role": "user", "content": "Explain what an idempotent endpoint is"}]
)
print(response.choices[0].message.content)
Native Anthropic calls
The platform implements the Anthropic Messages API. Use the official anthropic SDK directly, or send an HTTP request in its native format:
POST https://api.yomiapi.com/v1/messages
Python example
pip install anthropic
from anthropic import Anthropic
client = Anthropic(
api_key="YOUR_API_KEY",
base_url="https://api.yomiapi.com"
)
message = client.messages.create(
model="claude-sonnet-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Explain what an idempotent endpoint is"}]
)
print(message.content[0].text)
cURL example
curl https://api.yomiapi.com/v1/messages \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Explain what an idempotent endpoint is"}]
}'
In the native format, set
base_url to https://api.yomiapi.com (without /v1); the SDK appends /v1/messages automatically. Authenticate with either the x-api-key header or Authorization Bearer. In native format, max_tokens is required.Which format to choose
- OpenAI compatible: Prefer this for an existing OpenAI stack or when you need one codebase to switch among multiple providers' models.
- Native Anthropic: Choose this if your project uses the anthropic SDK or needs native request structures from Anthropic's documentation, such as the system field or content blocks.
Recommendations
- For long-document analysis and complex multi-step agent tasks, choose
claude-opus-4-8. For everyday production and main agent workloads, chooseclaude-sonnet-5for faster responses. - Billing is identical for both formats, based on the selected model's published prices and actual usage. See Usage for detailed charges.
