OPENCLAW + GEMINI

Use Gemini in OpenClaw.

Google Gemini is available through RunAPI's OpenAI-compatible endpoint — Gemini 3.5 Flash for sub-100ms first-token latency, 3.x Pro for complex reasoning, and 2.5 Pro for production workloads. OpenClaw treats it as another OpenAI-compatible model, so the same provider config and RUNAPI_API_KEY that powers GPT also calls Gemini. No Google Cloud project, no service account, no Vertex AI setup.

one API key · OpenAI-compatible chat endpoint · streaming support
Use RunAPI to send a chat request to Google Gemini 3.5 Flash.

Requirements:
- Use the RunAPI OpenAI-compatible endpoint at https://runapi.ai/v1/chat/completions
- Set model to "gemini-3.5-flash"
- Use the RUNAPI_API_KEY environment variable for authorization
- The response is synchronous — the reply arrives in choices[0].message.content
- For streaming, set stream to true and process server-sent events
curl -X POST https://runapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.5-flash",
    "messages": [
      {"role": "system", "content": "You are a concise technical assistant."},
      {"role": "user", "content": "Explain the difference between gRPC and REST in three sentences."}
    ],
    "temperature": 0.7,
    "max_tokens": 256
  }'
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": "gemini-3.5-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "gRPC uses HTTP/2 and Protocol Buffers for strongly-typed, multiplexed RPC calls with built-in code generation. REST uses HTTP/1.1 (or 2) with JSON payloads and relies on URL paths and HTTP verbs for resource semantics. gRPC is faster for service-to-service calls; REST is simpler to debug and more widely supported by browsers."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 34,
    "completion_tokens": 71,
    "total_tokens": 105
  }
}
Copy the curl command to test gemini
HOW IT WORKS

Use Gemini in OpenClaw in three steps

1

Configure RunAPI

Set the RUNAPI_API_KEY environment variable. If you already configured RunAPI as an OpenClaw provider, the same key and baseUrl work for Gemini — just change the model ID. No Google Cloud credentials needed.

export RUNAPI_API_KEY=runapi_xxx
2

Call Gemini via chat completions

Send a POST request to /v1/chat/completions with model set to gemini-3.5-flash. Pass a messages array with system and user roles. The endpoint accepts the same OpenAI-compatible shape your agent already uses for GPT models.

POST /v1/chat/completions
3

Read the response

The response arrives synchronously in OpenAI chat completion format. The assistant reply is in choices[0].message.content, with token usage in the usage object. For streaming, set stream to true and parse SSE events.

choices[0].message.content
PARAMETERS

Gemini chat completions API parameters

Parameter Type Description
model string Required. gemini-3.5-flash, gemini-2.5-flash, gemini-2.5-pro, gemini-3-flash-preview, gemini-3-pro-preview, or gemini-3.1-pro-preview.
messages array Required. Array of message objects with role (system, user, assistant) and content fields.
temperature number Optional. Sampling temperature between 0 and 2. Lower values produce more deterministic output. Default varies by model.
max_tokens integer Optional. Maximum number of tokens to generate in the response.
stream boolean Optional. When true, the response streams as server-sent events. Each event contains a delta with partial content.
top_p number Optional. Nucleus sampling threshold between 0 and 1. Alternative to temperature for controlling output randomness.

What is Gemini on OpenClaw?

Google Gemini is available through RunAPI without a Google Cloud project, service account, or Vertex AI setup. OpenClaw treats it as another OpenAI-compatible model -- same provider config and RUNAPI_API_KEY. Gemini 3.5 Flash gives you sub-100ms first-token latency for real-time agent loops, while Gemini 2.5 Pro handles long-context tasks with its 1M token context window and thinking mode for complex reasoning.

Gemini use cases

Multimodal applications with text, image, audio, and video

Send images, PDFs, audio files, or video frames alongside text prompts for Gemini to analyze, describe, or extract structured data. Gemini handles all input types natively through one API call.

Long document analysis with 1M token context

Feed entire codebases, legal document sets, or research paper collections into Gemini 2.5 Pro's 1M token context window for analysis and summarization without chunking or retrieval pipelines.

Real-time agent loops with Flash

Use Gemini 3.5 Flash for speed-sensitive agent tool-calling chains where sub-100ms first-token latency matters more than peak reasoning quality. Cost per million tokens is among the lowest available.

FAQ

Gemini + OpenClaw questions

OpenClaw general setup

Not configured yet? Start with the RunAPI setup guide for OpenClaw.

OpenClaw setup guide →

Gemini model catalog

See all Gemini variants, pricing tiers, and API documentation.

Gemini models →

Try Gemini in OpenClaw today.

Get a free RunAPI key, set the model to gemini-3.5-flash in your OpenClaw provider, and start chatting with Gemini.