Call Gemini model method

http
POST /ai/v1beta/models/{model_method}

Call Gemini model method.

Servers

json
[
  {
    "url": "https://api.veryfront.com"
  }
]

Authentication

json
[
  {
    "bearerAuth": []
  },
  {
    "apiKeyAuth": []
  }
]
json
{
  "bearerAuth": {
    "type": "http",
    "scheme": "bearer",
    "bearerFormat": "JWT or API Key",
    "description": "Use a JWT bearer token or a Veryfront API key in the `Authorization` header."
  },
  "apiKeyAuth": {
    "type": "apiKey",
    "in": "header",
    "name": "X-API-Key",
    "description": "Alternative API key header for `vf_<prefix>_<secret>` tokens."
  }
}

Parameters

NameLocationRequiredDescription
model_methodpathYes
x-veryfront-project-referenceheaderNo
x-veryfront-project-idheaderNo
x-veryfront-project-slugheaderNo
x-veryfront-agent-run-idheaderNo
x-veryfront-conversation-idheaderNo
x-veryfront-message-idheaderNo
x-veryfront-agent-idheaderNo
x-veryfront-billing-group-idheaderNo

Parameter contracts

json
[
  {
    "schema": {
      "type": "string",
      "description": "The model and the Gemini method, `<model>:<method>`, on the vendor-neutral base URL `/ai/v1beta`, served through the same gateway pipeline as the vendor route. The model is a catalog id or alias (`gemini-2.5-flash`, `google/gemini-2.5-flash`) and selects the deployment; the method is `generateContent`, `streamGenerateContent`, `embedContent` or `batchEmbedContents`. `streamGenerateContent` streams and honours `?alt=sse`.",
      "example": "gemini-2.5-flash:generateContent"
    },
    "required": true,
    "name": "model_method",
    "in": "path"
  },
  {
    "schema": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "description": "Canonical project selector: a UUID or slug for model access, inference and billing context. A signed project scope takes precedence. Otherwise, send only one project selector header."
    },
    "required": false,
    "name": "x-veryfront-project-reference",
    "in": "header"
  },
  {
    "schema": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "description": "Compatibility selector accepting a project UUID. Prefer x-veryfront-project-reference."
    },
    "required": false,
    "name": "x-veryfront-project-id",
    "in": "header"
  },
  {
    "schema": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "description": "Compatibility selector accepting a project slug. Prefer x-veryfront-project-reference."
    },
    "required": false,
    "name": "x-veryfront-project-slug",
    "in": "header"
  },
  {
    "schema": {
      "type": "string",
      "minLength": 1,
      "maxLength": 245,
      "description": "Durable run ID. Required for run-bound service-account credentials."
    },
    "required": false,
    "name": "x-veryfront-agent-run-id",
    "in": "header"
  },
  {
    "schema": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "description": "Durable conversation ID. Required with agent run attribution."
    },
    "required": false,
    "name": "x-veryfront-conversation-id",
    "in": "header"
  },
  {
    "schema": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "description": "Durable message ID. Required with agent run attribution."
    },
    "required": false,
    "name": "x-veryfront-message-id",
    "in": "header"
  },
  {
    "schema": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "description": "Agent ID. Must match the authenticated run-bound credential."
    },
    "required": false,
    "name": "x-veryfront-agent-id",
    "in": "header"
  },
  {
    "schema": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "description": "Optional billing group. Run requests are pinned to agent-run:<run-id>."
    },
    "required": false,
    "name": "x-veryfront-billing-group-id",
    "in": "header"
  }
]

Request body

json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "title": "NeutralGoogleRequest",
        "type": "object",
        "description": "Gemini-native request body (`contents` for generateContent, `content` for embedContent, `requests` for batchEmbedContents), forwarded as sent.",
        "additionalProperties": true
      }
    }
  }
}

Responses

200

Upstream provider response (forwarded as-is)

json
{
  "description": "Upstream provider response (forwarded as-is)"
}

400

Invalid request

json
{
  "description": "Invalid request",
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/NeutralGoogleError"
      }
    }
  }
}

401

Unauthorized

json
{
  "description": "Unauthorized",
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/NeutralGoogleError"
      }
    }
  }
}

402

Insufficient AI credits, an exhausted monthly AI budget, or a provider spend limit

json
{
  "description": "Insufficient AI credits, an exhausted monthly AI budget, or a provider spend limit",
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/NeutralGoogleError"
      }
    }
  }
}

403

Project access denied

json
{
  "description": "Project access denied",
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/NeutralGoogleError"
      }
    }
  }
}

404

No deployment of this model speaks this protocol natively

json
{
  "description": "No deployment of this model speaks this protocol natively",
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/NeutralGoogleError"
      }
    }
  }
}

413

Request body over the 32 MiB limit (code request_too_large), or an upstream 413 re-rendered in this envelope

json
{
  "description": "Request body over the 32 MiB limit (code request_too_large), or an upstream 413 re-rendered in this envelope"
}

429

The calling API key's requests-per-minute limit (code key-rate-limited), or an upstream provider rate limit re-rendered in this envelope with its Retry-After

json
{
  "description": "The calling API key's requests-per-minute limit (code key-rate-limited), or an upstream provider rate limit re-rendered in this envelope with its Retry-After"
}

500

Gateway error, or an upstream 500 re-rendered in this envelope

json
{
  "description": "Gateway error, or an upstream 500 re-rendered in this envelope"
}

502

Gateway proxy error, or an upstream 502 re-rendered in this envelope

json
{
  "description": "Gateway proxy error, or an upstream 502 re-rendered in this envelope"
}

503

No available deployment, auth unavailable, or an upstream 503 re-rendered in this envelope

json
{
  "description": "No available deployment, auth unavailable, or an upstream 503 re-rendered in this envelope"
}

529

Upstream provider overloaded, re-rendered in this envelope

json
{
  "description": "Upstream provider overloaded, re-rendered in this envelope"
}

default

Any other status the upstream provider returned, with the upstream status and its body (if any) re-rendered in this envelope

json
{
  "description": "Any other status the upstream provider returned, with the upstream status and its body (if any) re-rendered in this envelope"
}

Referenced contracts

components/schemas/NeutralGoogleError

json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "integer"
        },
        "message": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "details": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "@type": {
                    "type": "string",
                    "enum": [
                      "type.googleapis.com/google.rpc.ErrorInfo"
                    ]
                  },
                  "reason": {
                    "type": "string"
                  },
                  "domain": {
                    "type": "string"
                  }
                },
                "required": [
                  "@type",
                  "reason",
                  "domain"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "@type": {
                    "type": "string",
                    "enum": [
                      "type.googleapis.com/google.rpc.RetryInfo"
                    ]
                  },
                  "retryDelay": {
                    "type": "string"
                  }
                },
                "required": [
                  "@type",
                  "retryDelay"
                ]
              },
              {
                "type": "object",
                "properties": {
                  "@type": {
                    "type": "string",
                    "enum": [
                      "type.googleapis.com/google.rpc.QuotaFailure"
                    ]
                  },
                  "violations": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "quotaId": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "quotaId"
                      ]
                    }
                  }
                },
                "required": [
                  "@type",
                  "violations"
                ]
              }
            ]
          }
        },
        "veryfront": {
          "type": "object",
          "additionalProperties": {}
        }
      },
      "required": [
        "code",
        "message",
        "status"
      ]
    }
  },
  "required": [
    "error"
  ]
}

Operation contract

json
{
  "operationId": "neutralGoogleModelMethod",
  "tags": [
    "ai-gateway/Inference/Gemini inference"
  ],
  "summary": "Call Gemini model method",
  "description": "Call Gemini model method.",
  "parameters": [
    {
      "schema": {
        "type": "string",
        "description": "The model and the Gemini method, `<model>:<method>`, on the vendor-neutral base URL `/ai/v1beta`, served through the same gateway pipeline as the vendor route. The model is a catalog id or alias (`gemini-2.5-flash`, `google/gemini-2.5-flash`) and selects the deployment; the method is `generateContent`, `streamGenerateContent`, `embedContent` or `batchEmbedContents`. `streamGenerateContent` streams and honours `?alt=sse`.",
        "example": "gemini-2.5-flash:generateContent"
      },
      "required": true,
      "name": "model_method",
      "in": "path"
    },
    {
      "schema": {
        "type": "string",
        "minLength": 1,
        "maxLength": 255,
        "description": "Canonical project selector: a UUID or slug for model access, inference and billing context. A signed project scope takes precedence. Otherwise, send only one project selector header."
      },
      "required": false,
      "name": "x-veryfront-project-reference",
      "in": "header"
    },
    {
      "schema": {
        "type": "string",
        "minLength": 1,
        "maxLength": 255,
        "description": "Compatibility selector accepting a project UUID. Prefer x-veryfront-project-reference."
      },
      "required": false,
      "name": "x-veryfront-project-id",
      "in": "header"
    },
    {
      "schema": {
        "type": "string",
        "minLength": 1,
        "maxLength": 255,
        "description": "Compatibility selector accepting a project slug. Prefer x-veryfront-project-reference."
      },
      "required": false,
      "name": "x-veryfront-project-slug",
      "in": "header"
    },
    {
      "schema": {
        "type": "string",
        "minLength": 1,
        "maxLength": 245,
        "description": "Durable run ID. Required for run-bound service-account credentials."
      },
      "required": false,
      "name": "x-veryfront-agent-run-id",
      "in": "header"
    },
    {
      "schema": {
        "type": "string",
        "minLength": 1,
        "maxLength": 255,
        "description": "Durable conversation ID. Required with agent run attribution."
      },
      "required": false,
      "name": "x-veryfront-conversation-id",
      "in": "header"
    },
    {
      "schema": {
        "type": "string",
        "minLength": 1,
        "maxLength": 255,
        "description": "Durable message ID. Required with agent run attribution."
      },
      "required": false,
      "name": "x-veryfront-message-id",
      "in": "header"
    },
    {
      "schema": {
        "type": "string",
        "minLength": 1,
        "maxLength": 255,
        "description": "Agent ID. Must match the authenticated run-bound credential."
      },
      "required": false,
      "name": "x-veryfront-agent-id",
      "in": "header"
    },
    {
      "schema": {
        "type": "string",
        "minLength": 1,
        "maxLength": 255,
        "description": "Optional billing group. Run requests are pinned to agent-run:<run-id>."
      },
      "required": false,
      "name": "x-veryfront-billing-group-id",
      "in": "header"
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "title": "NeutralGoogleRequest",
          "type": "object",
          "description": "Gemini-native request body (`contents` for generateContent, `content` for embedContent, `requests` for batchEmbedContents), forwarded as sent.",
          "additionalProperties": true
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Upstream provider response (forwarded as-is)"
    },
    "400": {
      "description": "Invalid request",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/NeutralGoogleError"
          }
        }
      }
    },
    "401": {
      "description": "Unauthorized",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/NeutralGoogleError"
          }
        }
      }
    },
    "402": {
      "description": "Insufficient AI credits, an exhausted monthly AI budget, or a provider spend limit",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/NeutralGoogleError"
          }
        }
      }
    },
    "403": {
      "description": "Project access denied",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/NeutralGoogleError"
          }
        }
      }
    },
    "404": {
      "description": "No deployment of this model speaks this protocol natively",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/NeutralGoogleError"
          }
        }
      }
    },
    "413": {
      "description": "Request body over the 32 MiB limit (code request_too_large), or an upstream 413 re-rendered in this envelope"
    },
    "429": {
      "description": "The calling API key's requests-per-minute limit (code key-rate-limited), or an upstream provider rate limit re-rendered in this envelope with its Retry-After"
    },
    "500": {
      "description": "Gateway error, or an upstream 500 re-rendered in this envelope"
    },
    "502": {
      "description": "Gateway proxy error, or an upstream 502 re-rendered in this envelope"
    },
    "503": {
      "description": "No available deployment, auth unavailable, or an upstream 503 re-rendered in this envelope"
    },
    "529": {
      "description": "Upstream provider overloaded, re-rendered in this envelope"
    },
    "default": {
      "description": "Any other status the upstream provider returned, with the upstream status and its body (if any) re-rendered in this envelope"
    }
  },
  "x-documentation-source-tag": "Gemini Models",
  "x-canonical-documentation": {
    "domain": "ai-gateway",
    "resource": "Inference",
    "subgroup": "Gemini inference",
    "name": "Call Gemini model method",
    "description": "Call Gemini model method.",
    "operationId": "neutralGoogleModelMethod"
  },
  "x-mint": {
    "href": "/cloud/rest/api-reference/ai-gateway-inference-gemini-inference/call-gemini-model-method"
  }
}