OpenClaw で Gemini を使う。
Google Gemini は RunAPI の OpenAI 互換エンドポイント経由で利用できます — Gemini 3.5 Flash は 100ms 未満の初回トークン遅延、3.x Pro は複雑な推論、2.5 Pro は本番ワークロードに対応します。OpenClaw はこれを別の OpenAI 互換モデルとして扱うため、GPT を動かすのと同じ provider 設定と RUNAPI_API_KEY で Gemini も呼び出せます。Google Cloud プロジェクトも、サービスアカウントも、Vertex AI のセットアップも不要です。
RunAPI を使って Google Gemini 3.5 Flash にチャットリクエストを送信します。
要件:
- RunAPI の OpenAI 互換エンドポイント https://runapi.ai/v1/chat/completions を使用する
- model を "gemini-3.5-flash" に設定する
- RUNAPI_API_KEY 環境変数を認証に使用する
- レスポンスは同期的です — 返答は choices[0].message.content に届きます
- ストリーミングする場合は stream を true に設定し、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
}
}
OpenClaw で Gemini を使う3ステップ
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
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
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
Gemini chat completions API パラメータ
| パラメータ | 型 | 説明 |
|---|---|---|
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. |
OpenClaw上のGeminiとは?
Google GeminiはRunAPIを通じてGoogle Cloudプロジェクト・サービスアカウント・Vertex AIのセットアップなしに利用できます。OpenClawはそれを別のOpenAI互換モデルとして扱います——同じprovider設定とRUNAPI_API_KEY。Gemini 3.5 Flashはリアルタイムagentループ向けにサブ100msの最初のトークンレイテンシーを提供し、Gemini 2.5 Proは100万トークンのコンテキストウィンドウと思考モードで複雑な推論の長コンテキストタスクを処理します。
Geminiの活用例
テキスト・画像・音声・動画のマルチモーダルアプリ
テキストプロンプトと一緒に画像・PDF・音声ファイル・動画フレームを送ってGeminiに分析・説明・構造化データ抽出をさせます。Geminiは1回のAPI呼び出しで全ての入力タイプをネイティブに処理します。
100万トークンコンテキストによる長文書分析
コードベース全体・法的文書セット・研究論文コレクションをGemini 2.5 Proの100万トークンコンテキストウィンドウに入力して分析・要約を行い、チャンキングや検索パイプラインは不要です。
Flashを使ったリアルタイムagentループ
サブ100msの最初のトークンレイテンシーがピーク推論品質より重要な速度敏感なagentツール呼び出しチェーンにGemini 3.5 Flashを使用します。100万トークンあたりのコストは最低水準の一つです。
Gemini + OpenClaw のよくある質問
Yes. RunAPI provides Gemini access through its OpenAI-compatible endpoint. You only need a RUNAPI_API_KEY -- no Google Cloud project, no service account JSON, no Vertex AI billing setup.
Flash (gemini-3.5-flash) is fastest and cheapest -- best for real-time agent loops, classification, and tool-calling chains. Pro (gemini-2.5-pro) handles complex reasoning, long-context analysis, and multi-step tasks where accuracy matters more than speed.
RunAPI uses pay-per-token billing for Gemini with no free tier. However, Gemini Flash rates are among the lowest in the RunAPI catalog. Input and output tokens are metered separately. Check the RunAPI pricing page for current rates.
Yes. Both use the same RunAPI provider config and API key. Change the model parameter from gemini-3.5-flash to gpt-5.5 (or any other RunAPI model) without reconfiguring the provider. OpenClaw selects models per request.
Yes. RunAPI passes the OpenAI-compatible tools and tool_choice parameters to Gemini. Define tools in the request body and Gemini returns tool_calls in the assistant message. OpenClaw processes these the same way it handles tool calls from GPT or Claude.
今すぐ OpenClaw で Gemini を試す。
無料の RunAPI キーを取得し、OpenClaw の provider でモデルを gemini-3.5-flash に設定すれば、Gemini との対話を始められます。