Yomi APIYomi APIDocs Open console

中文

Yomi API / Documentation / Gemini native format

Developer integration

Gemini native format

Yomi API supports Gemini's native generateContent format through /v1beta routes for projects using the provider's native SDK style. See the Model Catalog (Models in the console) for available models. The examples below illustrate only the calling format.

Endpoint address

POST https://api.yomiapi.com/v1beta/models/{model}:generateContent

For streaming, use the :streamGenerateContent action with the alt=sse query parameter:

POST https://api.yomiapi.com/v1beta/models/{model}:streamGenerateContent?alt=sse

Authentication methods

  • Request headers: x-goog-api-key: YOUR_API_KEY, in Google's native style.
  • URL parameter: ?key=YOUR_API_KEY.
  • Generic method: Authorization: Bearer YOUR_API_KEY.

cURL example

curl https://api.yomiapi.com/v1beta/models/{MODEL_ID}:generateContent \
  -H "x-goog-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{
      "role": "user",
      "parts": [{"text": "Summarize the uses of vector databases in three points"}]
    }]
  }'

Python example

Use Google's official google-genai SDK and point base_url to the platform:

pip install google-genai
from google import genai

client = genai.Client(
    api_key="YOUR_API_KEY",
    http_options={"base_url": "https://api.yomiapi.com"}
)

response = client.models.generate_content(
    model="YOUR_AVAILABLE_MODEL_ID",
    contents="Summarize the uses of vector databases in three points"
)
print(response.text)

Available models

Model IDContextPositioning
Refer to the Model Catalog (Models in the console) for available models

Choosing between native and OpenAI-compatible formats

  • Choose native: When migrating a Google SDK project, using contents/parts multimodal structures, or needing Gemini-specific fields such as generationConfig and safety settings.
  • Choose OpenAI compatible: When you want one codebase shared with other models through /v1/chat/completions. Text, image input and function calling are supported.
Native requests follow Google's Gemini specification, so common fields from Gemini's documentation can be used directly. The platform automatically converts OpenAI-compatible requests. The same model ID works in both formats, subject to availability in the Model Catalog.