Yomi APIYomi APIDocs Open console

中文

Yomi API / Documentation / Switching models

Developer integration

Switching models

Yomi API's main advantage is one codebase for multiple models. After setting up the OpenAI format, change only the model parameter to switch models.

How to switch

All text models share the /v1/chat/completions endpoint and the same request structure. To switch models, change only the model parameter; the rest of the code stays the same.

cURL example

GPT-5.6-sol

curl https://api.yomiapi.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-5.6-sol", "messages": [{"role": "user", "content": "Hello"}]}'

Claude Sonnet 5

curl https://api.yomiapi.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "claude-sonnet-5", "messages": [{"role": "user", "content": "Hello"}]}'

DeepSeek V4 Pro

curl https://api.yomiapi.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "deepseek-v4-pro", "messages": [{"role": "user", "content": "Hello"}]}'

Python example

Iterate over several models with the same code to compare their output:

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.yomiapi.com/v1"
)

for model in ["gpt-5.6-sol", "claude-sonnet-5", "deepseek-v4-pro"]:
    response = client.chat.completions.create(
        model=model,
        messages=[{"role": "user", "content": "Introduce yourself in one sentence"}]
    )
    print(f"[{model}] {response.choices[0].message.content}")

Things to check when switching

  • Model ID: Use the ID shown in the Model Catalog (such as gpt-5.6-sol), not the display name.
  • Context length: Limits differ by model (for example, gpt-5.6-sol has 1.05M and claude-opus-4-8 has 200K). Check before switching long-context applications.
  • Key group: A key's group determines its available models. If a model is unavailable after switching, check the key's group in API Keys.
  • Call charges: Models have different prices. Check unit prices in the Model Catalog before calling and review charges under Usage after switching.