Use Agent402 from Claude Code, Cursor, VS Code, Windsurf, Cline, Roo Code, Codex CLI, Gemini CLI, Continue, ElizaOS, AgentCore and any OpenAI SDK
Agent402 opens two doors to an agent host, and both are paid with the same key:
- Models: an OpenAI-compatible gateway. Point any client that accepts a
base URL at
https://agent402.tools/v1/meteredwith a credits key as the API key. Each request is quoted from its own body (input plus yourmax_tokensat the model's list price, x1.15) and a card or credits buyer settles what the call actually used, from $0.001 a call.GET https://agent402.tools/v1/modelslists every id with its price and input cap;auto(routed per prompt, flat $0.01) lives athttps://agent402.tools/v1/auto. - Tools: the hosted MCP connector at
https://agent402.tools/mcp(discovery and the free tier need no key at all), or theagent402-mcpstdio server, which pays wallet-only tools by card whenAGENT402_CREDITS_KEYis set.
Get the key once: buy a pack by card at
agent402.tools/credits; the key (a402_…)
is shown once and emailed. GET /api/credits/balance (Bearer) reports what
is left. Prefer a wallet? Every route also answers a stock x402 402
(USDC on Base, Solana, Polygon, Arbitrum, Monad, Celo, Avalanche, Sei, Optimism, Stellar, or Algorand - or USDG on Robinhood Chain) and an MPP challenge, so any x402 client pays per call with no key.
Claude Code
Claude Code as an LLM client, billed per request under a quoted ceiling. Point
it at the metered tier with your credits key as the auth token (Bearer), keep
your usual model names - dated ids like claude-haiku-4-5-20251001 resolve
to the live model:
export ANTHROPIC_BASE_URL=https://agent402.tools/v1/metered
export ANTHROPIC_AUTH_TOKEN=a402_...
claude --model claude-sonnet-5
Verified 2026-08-27 with claude-cli 2.1.250: a full turn (110 KB system
prompt + 22 tool schemas, adaptive thinking, streaming) and a tool-use round
trip both complete; each turn is quoted from its own body (/v1/metered
accepts bodies to 1 MB / 200k input chars) and settles at actual usage, so an
idle turn costs cents, never the ceiling. Not carried on this wire:
output_config, context_management (dropped, the model default applies)
and server-side tools (web search, computer use) - Claude Code's own tools are
client tools and work as usual.
Tools over the hosted connector (free tier and discovery, no key):
claude mcp add --transport http agent402 https://agent402.tools/mcp
Paid tools by card, through the stdio server:
claude mcp add agent402 -e AGENT402_CREDITS_KEY=a402_... -- npx -y agent402-mcp
Or in .mcp.json at the project root:
{
"mcpServers": {
"agent402": {
"command": "npx",
"args": ["-y", "agent402-mcp"],
"env": { "AGENT402_CREDITS_KEY": "${AGENT402_CREDITS_KEY}" }
}
}
}
Cursor
.cursor/mcp.json in the project (or ~/.cursor/mcp.json for every
project). Remote, no key:
{ "mcpServers": { "agent402": { "url": "https://agent402.tools/mcp" } } }
Paid tools by card:
{
"mcpServers": {
"agent402": {
"command": "npx",
"args": ["-y", "agent402-mcp"],
"env": { "AGENT402_CREDITS_KEY": "a402_..." }
}
}
}
Continue
config.yaml. A model entry for chat, plus the connector for agent mode:
models:
- name: Agent402 (metered)
provider: openai
apiBase: https://agent402.tools/v1/metered
apiKey: a402_...
model: openai/gpt-4o-mini
roles:
- chat
mcpServers:
- name: Agent402
type: streamable-http
url: https://agent402.tools/mcp
Any id from /v1/models works as model; the metered route takes up to
85,000 characters of input per request.
ElizaOS
Tools: the elizaos-plugin-agent402
plugin adds AGENT402_FIND / AGENT402_CALL / AGENT402_ABOUT actions
("plugins": ["elizaos-plugin-agent402"], setting AGENT402_CREDITS_KEY).
Models: the OpenAI plugin reads its base URL from the environment, so no code changes:
OPENAI_BASE_URL=https://agent402.tools/v1/metered
OPENAI_API_KEY=a402_...
OPENAI_LARGE_MODEL=anthropic/claude-sonnet-5
OPENAI_MEDIUM_MODEL=openai/gpt-4o-mini
# embeddings live at /v1/embeddings ($0.002 a call), off the metered path
OPENAI_EMBEDDING_URL=https://agent402.tools/v1
OPENAI_EMBEDDING_MODEL=text-embedding-3-small
Any OpenAI SDK
from openai import OpenAI
client = OpenAI(base_url="https://agent402.tools/v1/metered", api_key="a402_...")
r = client.chat.completions.create(model="openai/gpt-4o-mini",
messages=[{"role": "user", "content": "One sentence on x402."}], max_tokens=60)
print(r.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://agent402.tools/v1/metered", apiKey: "a402_..." });
const r = await client.chat.completions.create({ model: "openai/gpt-4o-mini",
messages: [{ role: "user", content: "One sentence on x402." }], max_tokens: 60 });
console.log(r.choices[0].message.content);
Send an Idempotency-Key header on retries and a retried call replays the
paid answer instead of paying again.
The same metered pricing is on the Responses wire too, for the OpenAI Agents
SDK and responses.create(): base URL https://agent402.tools/v1/metered
(route /v1/metered/responses), function tools only, store always false.
Any Anthropic SDK (Messages wire)
The same metered pricing on the Anthropic Messages wire, at
https://agent402.tools/v1/metered (route /v1/metered/messages). Pass the
credits key as the SDK's auth_token (sent as Authorization: Bearer, which
the credits gate reads), not api_key (sent as x-api-key):
from anthropic import Anthropic
client = Anthropic(base_url="https://agent402.tools/v1/metered", auth_token="a402_...")
m = client.messages.create(model="anthropic/claude-haiku-4.5", max_tokens=60,
messages=[{"role": "user", "content": "One sentence on x402."}])
print(m.content[0].text)
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({ baseURL: "https://agent402.tools/v1/metered", authToken: "a402_..." });
const m = await client.messages.create({ model: "anthropic/claude-haiku-4.5", max_tokens: 60,
messages: [{ role: "user", content: "One sentence on x402." }] });
console.log(m.content[0].text);
Amazon Bedrock AgentCore
An AgentCore Gateway turns https://agent402.tools/openapi.json into MCP
tools with an OpenAPI target (agentcore add gateway-target --type open-api-schema --schema <path to openapi.json>), or aggregates the hosted
connector as an MCP server target. Paid calls ride
AgentCore Payments:
the agent forwards our 402 payload, AgentCore signs it from its managed
wallet, and the retry carries the proof in X-PAYMENT; every Agent402 route
answers a stock x402 v2 challenge, so nothing on our side needs configuring.
VS Code
GitHub Copilot's agent mode reads .vscode/mcp.json in the workspace (or
the user profile via the MCP: Open User Configuration command; MCP: Add Server in the palette writes either). Remote, free tier, no key:
{ "servers": { "agent402": { "type": "http", "url": "https://agent402.tools/mcp" } } }
Paid tools by card, through the stdio server with a credits key held in a prompted input (VS Code stores it, the file never carries it):
{
"inputs": [{ "type": "promptString", "id": "agent402-key", "description": "Agent402 credits key (a402_...)", "password": true }],
"servers": {
"agent402": {
"type": "stdio",
"command": "npx",
"args": ["-y", "agent402-mcp"],
"env": { "AGENT402_CREDITS_KEY": "${input:agent402-key}" }
}
}
}
Windsurf
Cascade reads ~/.codeium/windsurf/mcp_config.json (Streamable HTTP, SSE
and stdio are all supported; note Cascade caps the tools it can see at 100 in
total across servers, and this connector lists a small fixed set, not the
whole catalog). Remote, free tier:
{ "mcpServers": { "agent402": { "serverUrl": "https://agent402.tools/mcp" } } }
Paid tools by card, with the key read from the environment (${env:VAR}
interpolation is Windsurf's own):
{
"mcpServers": {
"agent402": {
"command": "npx",
"args": ["-y", "agent402-mcp"],
"env": { "AGENT402_CREDITS_KEY": "${env:AGENT402_CREDITS_KEY}" }
}
}
}
Cline
MCP Servers icon in the top toolbar, Configure tab, then Configure MCP
Servers (the CLI reads ~/.cline/mcp.json). Remote, free tier:
{
"mcpServers": {
"agent402": { "type": "streamableHttp", "url": "https://agent402.tools/mcp", "disabled": false, "autoApprove": [] }
}
}
Paid tools by card:
{
"mcpServers": {
"agent402": {
"command": "npx",
"args": ["-y", "agent402-mcp"],
"env": { "AGENT402_CREDITS_KEY": "a402_..." },
"disabled": false,
"autoApprove": []
}
}
}
Cline's own "OpenAI Compatible" provider also accepts a base URL, so the
models door works too: base URL https://agent402.tools/v1/metered, the
credits key as the API key, and a model id from /v1/models.
Roo Code
Settings icon in the Roo pane, then Edit Global MCP (mcp_settings.json) or
Edit Project MCP (.roo/mcp.json, which wins on a name clash). Remote,
free tier:
{
"mcpServers": {
"agent402": { "type": "streamable-http", "url": "https://agent402.tools/mcp", "alwaysAllow": [], "disabled": false }
}
}
Paid tools by card:
{
"mcpServers": {
"agent402": {
"command": "npx",
"args": ["-y", "agent402-mcp"],
"env": { "AGENT402_CREDITS_KEY": "a402_..." },
"alwaysAllow": [],
"disabled": false
}
}
}
OpenAI Codex CLI
One command for the free tier:
codex mcp add agent402 --url https://agent402.tools/mcp
Or in ~/.codex/config.toml, paid tools by card through the stdio server:
[mcp_servers.agent402]
command = "npx"
args = ["-y", "agent402-mcp"]
env = { AGENT402_CREDITS_KEY = "a402_..." }
Codex as a model host: its model_providers speak the Responses wire, and
the metered tier serves it at /v1/metered/responses (quoted per request
from the body, settled at actual usage for a credits key). In
~/.codex/config.toml:
model_provider = "agent402"
model = "anthropic/claude-haiku-4.5"
[model_providers.agent402]
name = "Agent402 (metered)"
base_url = "https://agent402.tools/v1/metered"
env_key = "AGENT402_CREDITS_KEY"
wire_api = "responses"
Then export AGENT402_CREDITS_KEY=a402_... and run codex. The route is
proven daily by the paid canary; a full Codex session against it has not yet
been run end to end, so if a turn is refused, the 400 body says exactly which
field (server tools and previous_response_id are not served).
Gemini CLI
One command for the free tier:
gemini mcp add --transport http agent402 https://agent402.tools/mcp
Or in ~/.gemini/settings.json (httpUrl is the Streamable HTTP key;
url means SSE), paid tools by card through the stdio server:
{
"mcpServers": {
"agent402": {
"command": "npx",
"args": ["-y", "agent402-mcp"],
"env": { "AGENT402_CREDITS_KEY": "a402_..." }
}
}
}
What the same key buys
The credits key that pays for chat pays for the rest: three wires on every tier (OpenAI chat, OpenAI Responses, Anthropic Messages), embeddings, rerank, images, speech and transcription, 500+ tools, finished reports and monitors, and a router that buys from other proven sellers on your agent's behalf. Why pay here, with the proof links: agent402.tools/why.