# Agent402 Gemini API Proxy (Pay-Per-Call)

> Agent402 Gemini API Proxy (Pay-Per-Call) is a paid API for AI agents from agent402.tools, paid per call via x402, $0.5/call, status unknown (last checked 2026-10-28).

Proxies a single Google Gemini content-generation request over x402 micropayment protocol, returning a Gemini-shaped response with no API key required.

## Facts

- Endpoint: POST https://agent402.tools/v1/premium/gemini?utm_source=zero.xyz
- Price: $0.5/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-28
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-gemini-api-proxy-pay-per-call-35c115c4
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_rbRnqXGA8EdwiHhoGd3Mb

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent402-gemini-api-proxy-pay-per-call-35c115c4 -d '<json body>'
```

Example prompt: Send this conversation to Gemini 2.5 Flash and get a response — use the system instruction 'You are a helpful assistant', the user message 'Explain x402 in one sentence', and pay the per-call fee automatically.

## When to prefer this

Choose this endpoint when you need to call Google Gemini from an autonomous AI agent without managing API keys or subscriptions, especially when operating in a pay-per-call or micropayment (x402/USDC) billing environment. It is ideal for agents that make sporadic or variable-volume Gemini calls where pre-paying for a quota would be wasteful, or when the agent runtime cannot securely store long-lived credentials.

## Known failure modes

- 402 Payment Required if x402 payment header is missing or USDC balance is insufficient
- 400 Bad Request if contents array is malformed or missing required fields
- Model not found if an unsupported model name is specified
- 429 Rate limit if too many concurrent requests are made
- Timeout or 503 if the upstream Gemini API is unavailable

## How this service works

Google's native generateContent wire on the premium tier. Send Gemini's own request shape (contents, systemInstruction, generationConfig, function declarations) and get Gemini's own response shape (candidates, usageMetadata) back. Point a Google GenAI SDK at this gateway and pay per request with USDC, no account. Also answers the Google-shaped path /v1beta/models/<model>:generateContent.

## Output

A Gemini-shaped JSON response containing an array of candidates, each with the model's generated content (role and text parts), a finishReason, the modelVersion string, and usageMetadata showing prompt, candidate, and total token counts.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "model": {
   "type": "string",
   "description": "Optional; the Google-shaped path carries it (/v1beta/models/<model>:generateContent)"
  },
  "tools": {
   "type": "array",
   "description": "[{functionDeclarations:[{name, description, parameters}]}]"
  },
  "contents": {
   "type": "array",
   "description": "Gemini turns: [{role, parts:[{text}|{inlineData}]}]"
  },
  "generationConfig": {
   "type": "object",
   "description": "maxOutputTokens, temperature, topP, stopSequences, responseMimeType, responseSchema"
  },
  "systemInstruction": {
   "type": "object",
   "description": "Optional system turn: {parts:[{text}]}"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "candidates": [
   {
    "index": 0,
    "content": {
     "role": "model",
     "parts": [
      {
       "text": "x402 is an HTTP-native way for agents to pay per request with USDC."
      }
     ]
    },
    "finishReason": "STOP"
   }
  ],
  "modelVersion": "google/gemini-3.5-flash-lite",
  "usageMetadata": {
   "totalTokenCount": 32,
   "promptTokenCount": 14,
   "candidatesTokenCount": 18
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-gemini-api-proxy-pay-per-call-35c115c4/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
