Run Gemini CLI as an API

Google's Gemini CLI. The last runtime to reach ACP, and it reached it on 2026-08-22.

Run Gemini CLI on a sandbox with your repositories, packages and credentials. Send a prompt over HTTP, follow the transcript, and send the next prompt to the same conversation. Fountain manages the machine between turns.

To use a chat interface, open Conversations. To call it from your own code, follow the quickstart, then use the agent definition below.

Summary

Provider google
Multi-provider No
Transport ACP, through the CLI's own --acp flag
Skills root /tmp/.gemini/skills
skills.sh agent gemini-cli
System prompt ~/.gemini/GEMINI.md
Credential A Gemini API key, exported as GEMINI_API_KEY

Why you would choose this one

You want a Gemini model in particular. That is the whole case.

Every runtime speaks ACP, so the transport no longer decides this. Choose opencode instead to move one agent definition between providers.

Set it up

apiVersion: fountain.dev/v1
kind: Agent
metadata:
name: gemini-agent
spec:
runtime: gemini
model: google/gemini-3.1-pro-preview

Add your Gemini key at /account/inference-credentials.

Call it over HTTP

After you apply the agent definition, set FOUNTAIN_AGENT_ID to the returned agent id, FOUNTAIN_BASE_URL to your instance URL, and FOUNTAIN_API_KEY to your Fountain account key. The account key is separate from the model credential.

curl -sS -X POST "$FOUNTAIN_BASE_URL/api/conversations" \
-H "Authorization: Bearer $FOUNTAIN_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"agent_id\": \"$FOUNTAIN_AGENT_ID\", \"prompt\": \"Which operating system and working directory are you in? Answer in one sentence.\"}"

Use the returned conversation id to follow events and send another prompt. A self-hosted instance uses the same request at its own base URL.

Verify

Run a conversation, then ask it what model it is. A turn that reaches output at all proves the credential, the runtime and the sandbox.

Limits

Every turn after the first replays the whole transcript. Gemini advertises loadSession and no resume capability, so a turn loads the session again from the start. Fountain discards that replay. The cost is time at the head of a turn, and it grows with the transcript. The other three runtimes reattach.

Fountain repairs gemini's session store after every turn. The store deletes a session while it loads it, an upstream defect (gemini-cli#28775). Fountain consolidates the store at the end of each turn, so a load cannot collide with what it loads. That workaround goes away when upstream lands a fix.