OpenModelOpenModel
API Reference

Gemini Protocol

Access Google Gemini models through the Gemini GenerateContent API format.

The Gemini protocol exposes the Google Gemini API format. It serves Google Gemini models exclusively, so there is no provider selector — use the Google GenAI SDK by simply changing the base URL. See the Gemini SDK guide for installation and full examples.

Endpoints

POST https://api.openmodel.ai/v1beta/models/{model}:generateContent
POST https://api.openmodel.ai/v1beta/models/{model}:streamGenerateContent

Use :generateContent for a single response, or :streamGenerateContent for incremental server-sent events.

Response Format for Streaming

streamGenerateContent supports two response formats:

RequestResponse
?alt=sseIncremental SSE events (text/event-stream)
No alt, or ?alt=jsonOne complete JSON array after generation finishes

OpenModel preserves the format selected by your client. The Google GenAI SDK handles this automatically; when calling the endpoint directly and you need live output, request alt=sse explicitly.

Authentication

Pass your OpenModel API key via the x-goog-api-key header, or as a key query parameter:

x-goog-api-key: om-your-api-key

Error format

Gemini errors carry an error.status field (e.g. UNAUTHENTICATED, INVALID_ARGUMENT), following the standard Gemini API shape.

Generate Content

POST
/v1beta/models/{model}:generateContent

Authorization

GoogApiKey
X-Goog-Api-Key<token>

Include your API key: X-Goog-Api-Key: om-your-api-key

In: header

Path Parameters

model*string

The model to use for content generation.

Query Parameters

key?string

API key (alternative to X-Goog-Api-Key header).

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/v1beta/models/gemini-3.5-flash:generateContent" \  -H "Content-Type: application/json" \  -d '{    "contents": [      {        "parts": [          {            "text": "Explain quantum computing in simple terms."          }        ]      }    ]  }'
{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "text": "Imagine a regular computer uses bits, which are like tiny switches that can be either OFF (0) or ON (1). A quantum computer uses quantum bits, or qubits, which can be both 0 and 1 at the same time."
          }
        ],
        "role": "model"
      },
      "finishReason": "STOP",
      "index": 0
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 8,
    "candidatesTokenCount": 102,
    "totalTokenCount": 110
  },
  "modelVersion": "gemini-3.5-flash"
}
{
  "error": {
    "code": 0,
    "message": "string",
    "status": "string"
  }
}
{
  "error": {
    "code": 0,
    "message": "string",
    "status": "string"
  }
}

Stream Generate Content

POST
/v1beta/models/{model}:streamGenerateContent

Authorization

GoogApiKey
X-Goog-Api-Key<token>

Include your API key: X-Goog-Api-Key: om-your-api-key

In: header

Path Parameters

model*string

The model to use for content generation.

Query Parameters

key?string

API key (alternative to X-Goog-Api-Key header).

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/v1beta/models/gemini-3.5-flash:streamGenerateContent" \  -H "Content-Type: application/json" \  -d '{    "contents": [      {        "parts": [          {            "text": "Write a short story about a robot learning to paint."          }        ]      }    ]  }'
{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "text": "string"
          }
        ],
        "role": "string"
      },
      "finishReason": "STOP",
      "index": 0
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 0,
    "candidatesTokenCount": 0,
    "totalTokenCount": 0
  },
  "modelVersion": "string"
}
{
  "error": {
    "code": 0,
    "message": "string",
    "status": "string"
  }
}
{
  "error": {
    "code": 0,
    "message": "string",
    "status": "string"
  }
}

On this page