81trust / 100

Gemini

by Gemini generateContent (base in AI models & inference

x402 APIPassing, checked 4 h ago

Google's native generateContent wire on the base 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.

POST https://agent402.tools/v1/gemini

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
193 ms typical, 193 ms slowest 5%
Last check
4 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://agent402.tools/v1/gemini" \
  -H "content-type: application/json" \
  -d '{"contents":[{"parts":[{"text":"Summarize x402 in one sentence."}],"role":"user"}],"generationConfig":{"maxOutputTokens":256}}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagent402.tools%2Fv1%2Fgemini
const res = await pay("https://agent402.tools/v1/gemini", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"contents":[{"parts":[{"text":"Summarize x402 in one sentence."}],"role":"user"}],"generationConfig":{"maxOutputTokens":256}}),
});
console.log(await res.json());

Example input

{
  "contents": [
    {
      "parts": [
        {
          "text": "Summarize x402 in one sentence."
        }
      ],
      "role": "user"
    }
  ],
  "generationConfig": {
    "maxOutputTokens": 256
  }
}

Example output

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

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
4 h agoPassed402193 ms$0.02