Migrate from the Gemini API

Use the Gemini generateContent shape at /v1beta/models/{model}:generateContent (and :streamGenerateContent) with an aiml key; route Gemini models through Google or run other models through the same client.

Before

POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent
x-goog-api-key: AIza…

After

POST https://api.ai.ml/v1beta/models/google/gemini-2.5-flash:generateContent
x-goog-api-key: aiml-live-…

Headers

Google Geminiai.ml
x-goog-api-key: AIza…x-goog-api-key: aiml-live-…
?key=… queryaccepted for compatibility; prefer the header

What changes, what does not

  • Function calling, JSON schema (responseSchema), images and system instructions are translated to the IR; grounding and code execution are Gemini-only and are passed through when routed to Google.
  • Usage metadata comes back in the Gemini shape with the aiml cost lines alongside.
  • Streaming uses the same SSE framing the Gemini SDKs expect.