{"uid":"cap_dheJP9wzRlOsk-pbpwBXI","slug":"agent402-gemini-pro-pay-per-call-gemini-api-via-x402-9fb6055f","name":"Agent402 Gemini Pro – Pay-Per-Call Gemini API via x402","description":"Google's native generateContent wire on the pro 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.","url":"https://agent402.tools/v1/pro/gemini?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"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}]}"}}},"responseSchema":{"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}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.1","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.1/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_c9YJCw6QySRO97kRzOk_w","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.1","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calls Google Gemini models (e.g. gemini-2.5-flash) with full Gemini-native request format, billed per call via x402/USDC — no API key required.","exampleAgentPrompt":"Ask Gemini 2.5 Flash to summarize the following research abstract and return JSON: '<abstract text here>' — use the pay-per-call Gemini endpoint so I don't need to manage API keys.","exampleUseCases":[{"title":"Keyless Gemini reasoning for agent pipeline","prompt":"I need you to send this multi-turn conversation to Gemini 2.5 Flash and get a response — I don't have a Google API key, so use the pay-per-call x402 route and charge my wallet."},{"title":"Structured JSON extraction with Gemini","prompt":"Use Gemini to extract the company name, date, and total amount from this invoice text and return a JSON object — set responseMimeType to application/json and define the schema with those three fields."},{"title":"Gemini function calling for agent tools","prompt":"Call Gemini Flash with these tool definitions — get_weather and search_web — pass my user message as the first turn, and let Gemini decide which function to call next."}],"resultDescription":"Returns a Gemini-compatible JSON response with a `candidates` array (each containing content.role, content.parts[].text, and finishReason), the resolved `modelVersion` string, and `usageMetadata` with promptTokenCount, candidatesTokenCount, and totalTokenCount.","failureModes":["Payment not received or insufficient USDC balance — 402 Payment Required returned before generation","Invalid or unsupported model name in path — 400 or 404 error","Malformed `contents` array (missing role or parts) — 400 validation error","Tool definitions with invalid parameter schemas — model may ignore tools or return error","Token limit exceeded in generationConfig — response truncated or 400 error","Network timeout on large outputs or slow model variants"],"whenToPreferThis":"Choose this endpoint when you need to call Google Gemini models (especially gemini-2.5-flash) using the native Gemini request format — including function calling, structured output via responseSchema, and system instructions — without registering for a Google API key. Ideal for AI agents that pay per inference using USDC/x402 micropayments and want zero-signup, keyless access to Gemini. Prefer it over OpenAI-compatible endpoints when your agent already constructs Gemini-native `contents` arrays with `role`/`parts` formatting.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-15T06:38:51.804Z","isFirstParty":false,"canonicalSlug":"agent402-gemini-pro-pay-per-call-gemini-api-via-x402-9fb6055f"}