RuntokenDocs

Gemini v1beta

Revision 1 · Updated 2026-11-12 · 1 min read

Call Gemini’s native v1beta interface through Runtoken.

Prerequisites#

Before you start, prepare:

  • A platform API key created in the console.
  • The exact ID of a model using Gemini v1beta.
  • A server-side HTTP environment; the streaming example uses curl.

Endpoint and authentication#

Send the platform key in x-goog-api-key.

POST/v1beta/models/{model}:streamGenerateContent

Use the gateway host https://api.runtoken.net. This native endpoint is not under /v1.

Send a request#

This streaming example uses alt=sse and a contents array containing text parts.

Stream Gemini outputbash
curl -N \
  'https://api.runtoken.net/v1beta/models/YOUR_MODEL_ID:streamGenerateContent?alt=sse' \
  -H 'x-goog-api-key: YOUR_PLATFORM_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "contents": [{
      "role": "user",
      "parts": [{ "text": "Hello!" }]
    }]
  }'

Replace these placeholders before running the example.

PlaceholderReplace with
YOUR_PLATFORM_KEYYour platform API key from the console.
YOUR_MODEL_IDA Gemini model ID from the catalogue; placed in the URL.

Keep these parts of the request URL unchanged.

URL componentPurpose
:streamGenerateContentKeep this method suffix after the model ID.
?alt=sseKeep this query parameter for the streaming request.

Process the stream#

Read the response as Gemini protocol data. curl -N disables output buffering; it does not turn Gemini events into an OpenAI response format.

Inference is stateless. Keep conversation context in your application and include the relevant content in later requests.

Model-specific input#

This example covers text input. Image or other media input, generation options and tool support need confirmation for the model you select.

Explicit cache and file resources are not supported. Do not build an integration that depends on uploading a persistent file resource or referring to an explicit cache object.

Next steps#

For a dedicated vector endpoint, see Embeddings. Shared routing and billing behavior is documented in the integration guide.

Was this page helpful?