{"uid":"cap_bfPGuAoMRF5KYQGcsBaDX","slug":"x402factory-ai-0af3de77","name":"x402factory.ai Base GPT LLM API","description":"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.","url":"https://x402factory.ai/base/llm/gpt","method":"POST","headers":{},"bodySchema":{"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."}}},"responseSchema":{"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."}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_NhftQRu5D5hr455B7qV9I","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calls OpenAI GPT models on demand via x402 micropayments on Base, with dynamic token-based pricing and custom agent creation/management","exampleAgentPrompt":"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?'","exampleUseCases":[{"title":"Pay-per-query GPT inference","prompt":"Use x402factory to send this message to gpt-5-mini and pay for it in USDC on Base — no API keys needed: 'Summarize the key differences between supervised and unsupervised machine learning in plain English.'"},{"title":"Create custom preprompt agent","prompt":"On x402factory, create a new custom agent with this preprompt so I can reuse it later: 'You are a concise legal document reviewer. Identify risks, missing clauses, and unclear language in any contract I send you.' Use gpt-5-mini, cap input at 1000 tokens, and allow up to 2000 output tokens."},{"title":"List my deployed agents","prompt":"Show me all the custom agents I've created on x402factory for my wallet — I want to see their IDs, models, and stored preprompts so I know which ones are available to call."}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T12:44:42.682Z","isFirstParty":false}