Home · All models · Pricing

GPT-4.1 Nano API, pay per call

Call GPT-4.1 Nano (openai/gpt-4.1-nano) with an OpenAI-compatible request and pay per call in USDC on Base with x402. No API key, no account, no subscription; automatic refund if the model fails to answer.

Endpoint: POST https://modelaccessgateway.com/llm/gpt-4.1-nano
Model id: openai/gpt-4.1-nano (fixed by the path; body.model can be omitted)
Payment: x402 v2, USDC on Base, one payment per request, exact price in the 402 quote
Price: set per request from the live supplier cost; where the cost allows it the gateway charges less than BlockRun for the same request

How to call it

  1. POST your OpenAI-style request to https://modelaccessgateway.com/llm/gpt-4.1-nano without payment. The answer is HTTP 402 with a PAYMENT-REQUIRED header: the exact price in USDC for that prompt and max_tokens (x402 v2, scheme exact, Base mainnet).
  2. Sign the payment with any x402 client (EIP-3009 transferWithAuthorization; the wallet needs USDC on Base, no ETH).
  3. Send the same request again with the PAYMENT-SIGNATURE header. You get a standard chat.completion (or server-sent events with "stream": true). If the model fails to answer, the payment is refunded automatically.
// npm i @x402/core @x402/evm @x402/fetch viem
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { wrapFetchWithPayment } from "@x402/fetch";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.WALLET_KEY), networks: ["eip155:8453"] });
const pay = wrapFetchWithPayment(fetch, client);
const r = await pay("https://modelaccessgateway.com/llm/gpt-4.1-nano", { method: "POST", headers: { "content-type": "application/json" },
  body: JSON.stringify({ messages: [{ role: "user", content: "Hello" }], max_tokens: 256 }) });
console.log((await r.json()).choices[0].message.content);

Quote only (free): curl -i -X POST https://modelaccessgateway.com/llm/gpt-4.1-nano -H 'content-type: application/json' -d '{"messages":[{"role":"user","content":"Hello"}],"max_tokens":256}'

When to use it

For AI agents, scripts and apps that need on-demand LLM inference from GPT-4.1 Nano (text generation, summarization, coding, function calling) and pay per call from a wallet instead of opening an account with a provider.

Limits

Machine-readable: OpenAPI, llms.txt, x402 manifest. Terms of use. The gateway is independent and not affiliated with any model provider; model names only identify the model that answers.