Pay-per-call LLM API, no API key

LLM inference API: OpenAI-compatible chat completions for 140 AI models (Claude, GPT, Gemini, Grok, DeepSeek, Qwen, Kimi, GLM), paid per call in USDC on Base with x402. No account, no API key, automatic refund if the model fails.

Endpoint: POST https://modelaccessgateway.com/v1/chat/completions (OpenAI format, model in body.model)
Models: 140, live list at /v1/models; one short route per model, for example /llm/claude-opus-5.5
Payment: x402 v2 on Base (USDC), one payment per request, from $0.0010; the exact price is in the 402 quote before you pay
Compatible: streaming (SSE), function calling, response_format, temperature, stop; max_tokens optional
Refunds: automatic, onchain, if the model fails to answer

When to use it

For AI agents, scripts and apps that need LLM inference on demand and can pay from a wallet: no sign-up, no monthly plan, no key to store. Each call is quoted and paid on its own.

Popular models

All models · Reference prices

How to call it

  1. POST your OpenAI-style request to https://modelaccessgateway.com/v1/chat/completions 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/v1/chat/completions", { 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/v1/chat/completions -H 'content-type: application/json' -d '{"messages":[{"role":"user","content":"Hello"}],"max_tokens":256}'

Use a prepaid key in your tools

Besides x402, the same models are sold with a prepaid key: buy credit with USDC on Base at /en/top-up (or with x402 at POST https://modelaccessgateway.com/v1/credits/topup?amount=5) and you get a key that starts with sk-mag-. Any OpenAI-compatible client works with base URL https://modelaccessgateway.com/v1 and that key; each answer carries the amount charged in the x-credit-charged-usdc header, and GET https://modelaccessgateway.com/v1/credits shows what is left. The price depends on the model, the prompt and max_tokens.

OpenClaw (plugin openclaw-model-access)
openclaw plugins install clawhub:openclaw-model-access --accept-capabilities
openclaw onboard --auth-choice model-access-api-key     # or: export MODELACCESS_API_KEY=sk-mag-...
openclaw models set model-access/anthropic/claude-sonnet-5.5
OpenCode (opencode.json)
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "modelaccess": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Model Access Gateway",
      "options": { "baseURL": "https://modelaccessgateway.com/v1", "apiKey": "{env:MODELACCESS_API_KEY}" },
      "models": {
        "anthropic/claude-sonnet-5.5": { "name": "Claude Sonnet 5.5", "limit": { "context": 64000, "output": 8192 } },
        "deepseek/deepseek-chat": { "name": "DeepSeek V4 Flash Chat", "limit": { "context": 64000, "output": 8192 } }
      }
    }
  },
  "model": "modelaccess/anthropic/claude-sonnet-5.5"
}
Continue (~/.continue/config.yaml, IDE extension or cn CLI)
name: Model Access Gateway
version: 1.0.0
schema: v1
models:
  - name: Claude Sonnet 5.5
    provider: openai
    model: anthropic/claude-sonnet-5.5
    apiBase: https://modelaccessgateway.com/v1
    apiKey: ${{ secrets.MODELACCESS_API_KEY }}
    roles: [chat, edit, apply]
    defaultCompletionOptions:
      maxTokens: 8192
LiteLLM (proxy config.yaml; the SDK takes the same model, api_base and api_key)
model_list:
  - model_name: claude-sonnet-5.5
    litellm_params:
      model: openai/anthropic/claude-sonnet-5.5
      api_base: https://modelaccessgateway.com/v1
      api_key: os.environ/MODELACCESS_API_KEY
      use_chat_completions_api: true
general_settings:
  master_key: os.environ/LITELLM_MASTER_KEY
Codex CLI: Codex only speaks the Responses API, so run it through the LiteLLM proxy above (use_chat_completions_api: true turns its Responses calls into chat completions). In ~/.codex/config.toml:
model_provider = "modelaccess"
model = "claude-sonnet-5.5"

[model_providers.modelaccess]
name = "Model Access Gateway (via LiteLLM)"
base_url = "http://127.0.0.1:4000/v1"
env_key = "LITELLM_MASTER_KEY"
wire_api = "responses"
OpenAI SDK, Cursor, Open WebUI, n8n: base URL https://modelaccessgateway.com/v1, API key sk-mag-..., model ids as in /v1/models (for example anthropic/claude-sonnet-5.5).

Machine-readable

OpenAPI 3.1 · llms.txt · x402 manifest · pricing.json · Terms of use

The gateway is independent and not affiliated with any model provider; model names only identify the model that answers.