Gateway API
The raw payment gateway. Handle the 402, attach an x402 proof, retry. Maximum control over headers, retries, and ledger events.
https://gateway.apiosk.com
Every endpoint on gateway.apiosk.com speaks x402. Your agent requests, the gateway replies 402 Payment Required with a price, your wallet signs a USDC payment on Base or Solana, and the data comes back. No API key, no account, no invoice.
Pick the surface that fits where your software runs. Same payment flow underneath, whether you reach for raw HTTP, a hosted MCP endpoint, the SDK, or the gateway skill.
The raw payment gateway. Handle the 402, attach an x402 proof, retry. Maximum control over headers, retries, and ledger events.
https://gateway.apiosk.com
A hosted MCP endpoint for chat-native agents. Add the URL, finish OAuth once, run paid tools from the same session.
https://mcp.apiosk.com/mcp
A package for application code that wraps payment execution, typed 402 errors, and retry helpers for Node backends.
npm install @apiosk/sdk
An installable skill for coding agents like Claude Code and Codex that need to run paid gateway requests from a shell.
npx skills add Apiosk/openclaw-apiosk --skill apiosk-gateway
Fund it with a few USDC and give your client a private key it can sign with. Payments settle on Base.
Every snippet below runs on a current Node or Python runtime. Pick the stack you already ship on.
Every example below uses a placeholder FX endpoint. Swap in any endpoint from the catalog at gateway.apiosk.com.
The lowest-level integration. wrapFetchWithPayment intercepts the 402, signs the payment, and retries automatically.
// pay-per-call.ts
// Run with: npx tsx pay-per-call.ts
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";
import { wrapFetchWithPayment } from "x402-fetch";
const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const walletClient = createWalletClient({
account,
chain: base,
transport: http(),
});
const fetchWithPayment = wrapFetchWithPayment(fetch, walletClient);
async function main(): Promise<void> {
const response = await fetchWithPayment(
"https://gateway.apiosk.com/v1/fx/convert?from=EUR&to=USD&amount=100",
);
const data = await response.json();
console.log(data);
}
main().catch(console.error);Same flow, for codebases already on axios.
// apiosk-client.ts
import axios from "axios";
import { privateKeyToAccount } from "viem/accounts";
import { withPaymentInterceptor } from "x402-axios";
const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
export const apiosk = withPaymentInterceptor(
axios.create({ baseURL: "https://gateway.apiosk.com" }),
account,
);
// Usage anywhere in your app:
// const { data } = await apiosk.get("/v1/email/verify", { params: { email } });The same pay-per-call flow for Python services, built on httpx and eth-account.
# pay_per_call.py
# pip install x402-httpx eth-account
import asyncio
import os
import httpx
from eth_account import Account
from x402_httpx import x402HTTPXClient
account = Account.from_key(os.environ["WALLET_PRIVATE_KEY"])
async def main() -> None:
async with x402HTTPXClient(account=account) as client:
response = await client.get(
"https://gateway.apiosk.com/v1/fx/convert",
params={"from": "EUR", "to": "USD", "amount": 100},
)
print(response.json())
asyncio.run(main())Expose an Apiosk endpoint as a tool your model can decide to call.
// tools/convert-currency.ts
import { tool } from "ai";
import { z } from "zod";
import { apiosk } from "../apiosk-client"; // the x402-axios client from example 2
export const convertCurrency = tool({
description:
"Convert an amount between two currencies using live FX rates. " +
"Costs a fraction of a cent per call, paid automatically in USDC.",
parameters: z.object({
from: z.string().describe("ISO currency code to convert from, e.g. EUR"),
to: z.string().describe("ISO currency code to convert to, e.g. USD"),
amount: z.number().positive(),
}),
execute: async ({ from, to, amount }) => {
const { data } = await apiosk.get("/v1/fx/convert", {
params: { from, to, amount },
});
return data;
},
});// agent.ts
import { generateText } from "ai";
import { anthropic } from "@ai-sdk/anthropic";
import { convertCurrency } from "./tools/convert-currency";
const result = await generateText({
model: anthropic("claude-sonnet-4-6"),
tools: { convertCurrency },
prompt: "What is 250 EUR in USD right now?",
});
console.log(result.text);Wrap a paid endpoint as a LangChain tool your Python agent can call. Paid per call in USDC via x402. No API key required.
# tools/convert_currency.py
import os
import httpx
from eth_account import Account
from langchain_core.tools import tool
from x402_httpx import x402Client
account = Account.from_key(os.environ["WALLET_PRIVATE_KEY"])
client = x402Client(account=account)
@tool
def convert_currency(from_code: str, to_code: str, amount: float) -> dict:
"""Convert an amount between two currencies using live FX rates.
Paid per call in USDC via x402. No API key required.
"""
response = client.get(
"https://gateway.apiosk.com/v1/fx/convert",
params={"from": from_code, "to": to_code, "amount": amount},
)
response.raise_for_status()
return response.json()One config block gives your assistant the entire Apiosk catalog as tools.
{
"mcpServers": {
"apiosk": {
"url": "https://gateway.apiosk.com/mcp",
"env": {
"WALLET_PRIVATE_KEY": "0x..."
}
}
}
}claude mcp add apiosk https://gateway.apiosk.com/mcpOne command and the agent can run paid tools through Apiosk.
claude mcp add apiosk -- npx -y apiosk-mcp-server
codex mcp add apiosk -- npx -y apiosk-mcp-server
https://mcp.apiosk.com/mcp
Each 402 response states the exact price up front. Nothing is charged without your client signing it.
Every settled call produces an on-chain receipt on Base. Set per-transaction and per-day caps in your wallet mandate so an agent loop can never drain funds.
Questions, or a missing endpoint you want listed? Email hello@apiosk.com.
No. Every endpoint on gateway.apiosk.com speaks x402. Your agent makes a request, the gateway replies 402 Payment Required with a price, your wallet signs a USDC payment on Base or Solana, and the data comes back. There is no API key, no account, and no invoice.
A helper such as wrapFetchWithPayment (fetch), withPaymentInterceptor (axios), or the x402HTTPXClient (Python) intercepts the 402 response, signs the payment with your wallet, and retries the request automatically. You call the endpoint as you normally would and get the data back.
Node and TypeScript via x402-fetch and x402-axios, Python via x402-httpx and eth-account, agent frameworks via the Vercel AI SDK and LangChain, and any MCP client (Claude Desktop, Claude Code, Cursor) via the hosted MCP endpoint.
Set spend caps per transaction and per day in your wallet mandate. The exact price is stated in every 402 response before payment, nothing is charged without your client signing it, and every settled call produces an on-chain receipt on Base you can verify independently.
Connect once. Keep your plans, keep your billing stack, keep your accounting process. Add the revenue line you've been turning away.