Generate content

Compatible with Google Gemini generateContent, for inference on conversational models. The official SDK works as-is.

post/v1beta/models/{model}:generateContent

Request

  • Base URL: https://gateway.amux.ai
  • URL: https://gateway.amux.ai/v1beta/models/{model}:generateContent
  • Auth: API key in header x-goog-api-key

Path parameters

modelstring required

Canonical ID, given in the path (Gemini puts the model name and the action in the URL). Do not escape the slash in vendor/model. The colon suffixes work here too — :provider to pin one, :@strategy to choose an ordering — placed before the action (models/vendor/model:@price:generateContent).

Headers

Content-Typestring required

Always application/json.

Request body

systemInstructionobject

System instruction, shaped like one contents entry. Not an entry in contents.

toolsobject[]

Callable tools, shaped { functionDeclarations: [{ name, description, parameters }] }. Note the extra wrapping layer.

safetySettingsobject[]

Safety threshold settings. Gemini-only; passed through unchanged.

cachedContentstring

Handle for explicitly cached content. Gemini-only, passed through — this is upstream-side state, so it is only reliable when you pin a provider. Cache hits come back in usage at their own lower rate, so billing what actually happened is correct and we do not strip it.

serviceTier'standard' | 'flex' | 'priority'

Service tier. Not supported — we forward it to no upstream, on either path, and serviceTier and service_tier are treated alike. Sending it is not an error. What was stripped is reported back: amux.droppedParams in the body, or the x-amux-dropped-params header when streaming.

storeboolean

Whether the upstream should log this request. Passed through unchanged; we do not retain request bodies ourselves.

Example request

{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Hello!"
        }
      ]
    }
  ]
}

Response

Inference succeeded.

Example response

{
  "candidates": [
    {
      "content": {
        "role": "user",
        "parts": [
          {
            "text": "Hello!"
          }
        ]
      },
      "finishReason": "STOP"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.