# x402factory.ai Base GPT LLM API

> x402factory.ai Base GPT LLM API is a paid API for AI agents from x402factory.ai, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-13).

Calls OpenAI GPT models on demand via x402 micropayments on Base, with dynamic token-based pricing and custom agent creation/management

## Facts

- Endpoint: POST https://x402factory.ai/base/llm/gpt
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402factory-ai-0af3de77
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_bfPGuAoMRF5KYQGcsBaDX

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402factory-ai-0af3de77 -d '<json body>'
```

Example prompt: Ask x402factory's Base GPT endpoint to answer this question using gpt-5-mini with up to 2000 output tokens and cap input at 1000 tokens, paying the default 0.01 USDC: 'What are the top three benefits of renewable energy?'

## When to prefer this

Choose this endpoint when you need pay-per-use GPT inference billed directly in USDC on the Base blockchain via x402 micropayments, especially for agentic workflows that need transparent, programmable AI spending without API key subscriptions. Prefer it over standard OpenAI APIs when you want crypto-native billing, or when you need to create and manage reusable custom agents with preprompts stored on-chain economics.

## Known failure modes

- Input message exceeds max_input_tokens cap — server returns error instead of under-pricing
- Insufficient USDC balance or failed x402 payment — request rejected with 402 status
- Unsupported model name — returns error indicating invalid model
- max_output_tokens or pricing parameters out of valid range — validation error
- Network congestion on Base causing payment confirmation delay

## How this service works

Base GPT wrapper API using x402 payments. Default direct call: model gpt-5-mini, max_output_tokens=2000, fixed price 0.01 USDC for up to 1000 input tokens. For all other settings the price is computed per model as (input_tokens * input_price_per_million + max_output_tokens * output_price_per_million) / 1,000,000, with a minimum of 0.001 USDC and always rounded up to 6 decimals. Optional max_input_tokens lets you cap the input tokens used for pricing; if the message is longer than this cap the server returns an error instead of under-pricing. Optional action=message (or omitting action) performs a direct GPT call with the given message. Optional action=create creates a custom agent with the given message as preprompt for 0.001 USDC (no OpenAI call), stores a base_price_usdc using (max_input_tokens_for_agent or 1000) + preprompt + max_output_tokens, and returns a custom_id. Optional action=list lists up to 100 recent custom agents for the paying wallet for 0.001 USDC without calling OpenAI. Custom agents can be called via POST /base/llm/gpt with custom_id, or POST /base/llm/gpt/{custom_id}. Each custom agent has a fixed price per call based on its stored preprompt, model, max_output_tokens and max_input_tokens; if the runtime message is longer than max_input_tokens the server returns an error. This specific request uses model gpt-5-mini with max_output_tokens=2000. Pricing mode: default. Prepaid price (x402) for this request: 0.010000 USDC.

## Output

Returns the GPT model's text response to the given message, along with x402 payment receipt metadata including the model used, token counts, pricing mode, and USDC amount charged. For action=create, returns a custom_id for the new agent. For action=list, returns up to 100 recent custom agents associated with the paying wallet.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "model": {
   "enum": [
    "gpt-5.1",
    "gpt-5-mini",
    "gpt-5-nano",
    "gpt-5-pro"
   ],
   "type": "string",
   "description": "Logical model name. One of: gpt-5.1, gpt-5-mini (default), gpt-5-nano, gpt-5-pro. Pricing is per model using per-million token rates."
  },
  "action": {
   "enum": [
    "create",
    "list"
   ],
   "type": "string",
   "description": "Optional action. Omit for direct GPT call. Use 'create' to create a custom agent with a preprompt, or 'list' to list your custom agents without calling OpenAI."
  },
  "message": {
   "type": "string",
   "description": "User message for the LLM. Required for normal GPT calls. For action=create this becomes the preprompt that is stored for the custom agent."
  },
  "custom_id": {
   "type": "string",
   "description": "Optional custom agent ID returned from action=create. When set, the preprompt + model from that agent are used. Can also be provided via URL: /base/llm/gpt/{custom_id}."
  },
  "max_input_tokens": {
   "type": "number",
   "description": "Optional hard ceiling on input tokens used for pricing. For normal calls this caps the user message tokens. For custom agents this caps the user message tokens on top of the fixed preprompt. If the actual message is longer than this value, the server returns an error instead of under-pricing."
  },
  "max_output_tokens": {
   "type": "number",
   "description": "Maximum number of output tokens. Default 2000. Higher limits increase the prepaid price because x402 payments are upfront."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "ok": {
  "type": "boolean",
  "description": "True on success"
 },
 "model": {
  "type": "string",
  "description": "Model used for this call"
 },
 "reply": {
  "type": "string",
  "description": "For GPT calls, the assistant reply text from OpenAI."
 },
 "action": {
  "type": "string",
  "description": "Action performed: 'call' for direct GPT calls, 'call_custom' for custom agents, 'create' for new custom agents, 'list' for listing your custom agents."
 },
 "agents": {
  "type": "array",
  "description": "For action=list: up to 100 recent custom agents for the paying wallet. Each entry includes custom_id, model, max_output_tokens, base_price_usdc, max_input_tokens, preprompt_preview (first 250 chars), created_at and updated_at."
 },
 "custom_id": {
  "type": "string",
  "description": "Custom agent ID used for this call, if any. For action=create this is the newly created agent ID."
 },
 "preprompt": {
  "type": "string",
  "description": "For action=create, the stored preprompt text. For custom calls, the preprompt used for the agent."
 },
 "price_usdc": {
  "type": "number",
  "description": "Price charged for this call in USDC (6 decimals, rounded up). Minimum is 0.001 USDC. Default direct calls cost 0.01 USDC for up to 1000 input tokens with gpt-5-mini and max_output_tokens=2000."
 },
 "base_price_usdc": {
  "type": "number",
  "description": "For action=create, the stored base price for the agent (max_input_tokens_for_agent + preprompt + max_output_tokens) using the selected model."
 },
 "max_output_tokens": {
  "type": "number",
  "description": "Maximum output tokens used for this call (after applying any defaults and limits)."
 },
 "estimated_input_tokens": {
  "type": "number",
  "description": "Estimated number of input tokens used for pricing. For custom agents this includes both preprompt and the agent's configured max_input_tokens."
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402factory-ai-0af3de77/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402factory.ai](https://www.zero.xyz/host/x402factory.ai/llms.txt)
