Skip to Content

Generate Google model content

POSThttps://api.respan.ai/api/google/{sdk_type}/v1beta/models/{model_name}:{render_format}

Send native Google Gen AI or Vertex AI requests through Respan using provider credentials configured in Respan. Authenticate with your Respan key in x-goog-api-key.

Servers

https://api.respan.ai: Respan API Server

Authentication

Use the authentication headers documented below.

Headers

Parameter Type Required Description and constraints
x-goog-api-key string Required
Your Respan API key in Google’s native authentication header.
Example: "YOUR_RESPAN_API_KEY"

Path parameters

Parameter Type Required Description and constraints
sdk_type string Required
Allowed: "gemini", "vertexai"
Example: "gemini"
model_name string Required
Example: "gemini-3.8-flash"
render_format string Required
Allowed: "generateContent", "streamGenerateContent"
Example: "generateContent"

Request body

A request body is required.

application/json

Field Type Requirement Description and constraints
$ object Required body
Additional properties are allowed

OpenAPI request schema

{
  "type": "object",
  "additionalProperties": true
}
Example
JSON
{ "contents": [ { "role": "user", "parts": [ { "text": "Reply with exactly ok." } ] } ], "generationConfig": { "maxOutputTokens": 128, "thinkingConfig": { "thinkingLevel": "low" } } }

Responses

200

Google response or event stream.

application/json

Field Type Requirement Description and constraints
$ object Body
Additional properties are allowed

OpenAPI response schema

{
  "type": "object",
  "additionalProperties": true
}
Example
JSON
{ "candidates": [ { "content": { "role": "model", "parts": [ { "text": "AI learns patterns from data to make predictions and generate responses." } ] }, "finishReason": "STOP", "index": 0 } ] }

text/event-stream

Field Type Requirement Description and constraints
$ string Body
-

OpenAPI response schema

{
  "type": "string"
}

400

Invalid request.

application/json

Field Type Requirement Description and constraints
$ object Body
Additional properties are allowed

OpenAPI response schema

{
  "type": "object",
  "additionalProperties": true
}

402

Insufficient credits.

application/json

Field Type Requirement Description and constraints
$ object Body
Additional properties are allowed

OpenAPI response schema

{
  "type": "object",
  "additionalProperties": true
}

403

The API key is missing, invalid or expired.

application/json

Field Type Requirement Description and constraints
$ object Body
-
detail string Required in parent
-

OpenAPI response schema

{
  "type": "object",
  "required": [
    "detail"
  ],
  "properties": {
    "detail": {
      "type": "string"
    }
  }
}
Example
JSON
{ "detail": "Your API key is invalid or expired, please check your API key in the platform settings." }

424

Upstream provider failed.

application/json

Field Type Requirement Description and constraints
$ object Body
Additional properties are allowed

OpenAPI response schema

{
  "type": "object",
  "additionalProperties": true
}

429

Rate limit exceeded.

application/json

Field Type Requirement Description and constraints
$ object Body
Additional properties are allowed

OpenAPI response schema

{
  "type": "object",
  "additionalProperties": true
}

OpenAPI source

The operation and referenced components below retain the complete OpenAPI definitions, including constraints and examples.

OpenAPI operation

{
  "summary": "Generate Google model content",
  "operationId": "api_google_v1beta_models_:_create",
  "tags": [
    "Google Gateway"
  ],
  "description": "Send native Google Gen AI or Vertex AI requests through Respan using provider credentials configured in Respan. Authenticate with your Respan key in `x-goog-api-key`.",
  "parameters": [
    {
      "name": "x-goog-api-key",
      "in": "header",
      "required": true,
      "schema": {
        "type": "string"
      },
      "description": "Your Respan API key in Google's native authentication header.",
      "example": "YOUR_RESPAN_API_KEY"
    },
    {
      "name": "sdk_type",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "enum": [
          "gemini",
          "vertexai"
        ]
      },
      "example": "gemini"
    },
    {
      "name": "model_name",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      },
      "example": "gemini-3.8-flash"
    },
    {
      "name": "render_format",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "enum": [
          "generateContent",
          "streamGenerateContent"
        ]
      },
      "example": "generateContent"
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "additionalProperties": true
        },
        "example": {
          "contents": [
            {
              "role": "user",
              "parts": [
                {
                  "text": "Reply with exactly ok."
                }
              ]
            }
          ],
          "generationConfig": {
            "maxOutputTokens": 128,
            "thinkingConfig": {
              "thinkingLevel": "low"
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Google response or event stream.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          },
          "example": {
            "candidates": [
              {
                "content": {
                  "role": "model",
                  "parts": [
                    {
                      "text": "AI learns patterns from data to make predictions and generate responses."
                    }
                  ]
                },
                "finishReason": "STOP",
                "index": 0
              }
            ]
          }
        },
        "text/event-stream": {
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "400": {
      "description": "Invalid request.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "402": {
      "description": "Insufficient credits.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/InvalidApiKey"
    },
    "424": {
      "description": "Upstream provider failed.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "429": {
      "description": "Rate limit exceeded.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    }
  },
  "security": []
}

OpenAPI path metadata

{}

Referenced OpenAPI components

{
  "responses": {
    "InvalidApiKey": {
      "description": "The API key is missing, invalid or expired.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "detail"
            ],
            "properties": {
              "detail": {
                "type": "string"
              }
            }
          },
          "example": {
            "detail": "Your API key is invalid or expired, please check your API key in the platform settings."
          }
        }
      }
    }
  }
}