{"openapi":"3.1.0","info":{"title":"Private AI Media Generation API","version":"1.1.0","description":"Pay-per-call AI image and video generation for autonomous agents — including a private model line — plus private LLM text completions. Two payment rails: x402 (no account — the request settles in USDC on Base via HTTP 402) or an account API key (`x-api-key: lp_…` / `Authorization: Bearer lp_…`, bills prepaid credits). Charges apply only when the call succeeds (4xx/5xx responses are never settled / are auto-refunded). Wallet-keyed volume discounts (5% at $100+, 10% at $500+, 15% at $2000+) apply on the x402 rail; resale of outputs is permitted.","x-guidance":"Use POST /v1/agent/generate to render images or videos, POST /v1/agent/chat for OpenAI-compatible text completions ({model, messages, max_tokens}). Pass 'modelId'/'model' (from GET /v1/agent/models) and optional settings; include 'payer' (your 0x wallet) for volume-tier pricing on x402. The 402 response carries exact per-call USDC requirements — or send an lp_ API key and the same call bills the owner's prepaid credits with no 402 round-trip.","contact":{"email":"tristayunsub@gmail.com"}},"components":{"securitySchemes":{"ApiKeyHeader":{"type":"apiKey","in":"header","name":"x-api-key","description":"Account API key (lp_…) — create at https://livepairai.com/settings after signing up at /auth/sign-up. Bills the key owner's prepaid credit balance."},"BearerKey":{"type":"http","scheme":"bearer","description":"Same lp_ API key as a Bearer token."}}},"paths":{"/v1/agent/models":{"get":{"operationId":"list_models","summary":"List agent-available models and per-call USD prices","security":[],"responses":{"200":{"description":"Model catalog","content":{"application/json":{"schema":{"type":"object","properties":{"models":{"type":"array","items":{"type":"object"}}}}}}}}}},"/v1/agent/balance":{"get":{"operationId":"get_balance","summary":"Prepaid credit balance and recent ledger for the lp_ key owner (x402 wallets are anonymous — key required)","security":[{"ApiKeyHeader":[]},{"BearerKey":[]}],"responses":{"200":{"description":"Balance in micro-USD plus the 10 most recent credit transactions","content":{"application/json":{"schema":{"type":"object","properties":{"balanceUsd":{"type":"number"},"balanceMicro":{"type":"integer"},"currency":{"type":"string"},"recent":{"type":"array","items":{"type":"object"}},"topUp":{"type":"string"}}}}}},"401":{"description":"Missing or invalid lp_ API key"}}}},"/v1/agent/generate":{"post":{"operationId":"generate_media","summary":"Generate an image or video (x402 or API-key paid)","security":[{"ApiKeyHeader":[]},{"BearerKey":[]},{}],"x-payment-info":{"price":{"mode":"dynamic","currency":"USD","min":"0.049091","max":"98.181819"},"protocols":[{"x402":{}}]},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["prompt"],"properties":{"prompt":{"type":"string","maxLength":2000},"modelId":{"type":"string","description":"model id from /v1/agent/models"},"image":{"type":"string","description":"Source image for i2i/i2v models — public http(s) URL or data:image URI (<=8MB). Use AI-generated or owned images only, never real-person photos without consent. Screened by the same policy check as the studio."},"imageSize":{"type":"string"},"aspectRatio":{"type":"string"},"duration":{"type":"number","description":"Video length in seconds — billed per second at the model's per-resolution rate"},"resolution":{"type":"string"},"audio":{"type":"boolean","description":"Audio track on audio-capable video models (default on)"},"payer":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Your payer wallet — applies your volume-tier discount to the 402 quote (5% at $100+, 10% at $500+, 15% at $2000+ lifetime paid). Must equal the wallet that signs the payment."}}}}}},"responses":{"200":{"description":"{status:'done',url} or {status:'running',jobId,poll} — payment settles on submit","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["done","running"]},"url":{"type":"string"},"jobId":{"type":"string"},"poll":{"type":"string"}},"required":["status"]}}}},"402":{"description":"Payment Required — PAYMENT-REQUIRED header carries accepts[] requirements (USDC on Base eip155:8453)"}}}},"/v1/agent/chat":{"post":{"operationId":"chat_completions","summary":"Private LLM chat completion (x402 or API-key paid)","security":[{"ApiKeyHeader":[]},{"BearerKey":[]},{}],"description":"OpenAI-compatible chat completion — pass an OpenAI-style {model, messages, max_tokens} body, receive the standard {choices, usage} response. Price is per call: ceil(total message chars / 3.5) estimated input tokens × the model's input rate + max_tokens × its output rate, marked up — set max_tokens tight for tighter billing. Anonymous — no account; metering keeps token counts only.","x-payment-info":{"price":{"mode":"dynamic","currency":"USD","min":"0.002000","max":"0.252344"},"protocols":[{"x402":{}}]},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["messages"],"properties":{"model":{"type":"string","description":"Text model id — see textModels in GET /v1/agent/models (default: deepseek/deepseek-v4-flash)"},"messages":{"type":"array","maxItems":50,"description":"OpenAI chat messages — role system|user|assistant, string content, <=48000 chars total","items":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["system","user","assistant"]},"content":{"type":"string"}}}},"max_tokens":{"type":"number","maximum":8192,"default":1024,"description":"Output token cap — billed at this amount; set it tight to pay less"},"temperature":{"type":"number","minimum":0,"maximum":2},"payer":{"type":"string","pattern":"^0x[a-fA-F0-9]{40}$","description":"Your payer wallet — applies your volume-tier discount (5% at $100+, 10% at $500+, 15% at $2000+ lifetime paid). Must equal the wallet that signs the payment."}}}}}},"responses":{"200":{"description":"OpenAI chat completion — {choices:[{message:{role,content}}], usage:{prompt_tokens,completion_tokens}}","content":{"application/json":{"schema":{"type":"object","properties":{"choices":{"type":"array","items":{"type":"object"}},"usage":{"type":"object"}}}}}},"402":{"description":"Payment Required — PAYMENT-REQUIRED header carries accepts[] requirements (USDC on Base eip155:8453)"}}}},"/v1/agent/jobs/{id}":{"get":{"operationId":"get_job","summary":"Poll a running generation job (free)","security":[],"responses":{"200":{"description":"{status:'done',url} | {status:'running'} | {status:'failed'}","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"url":{"type":"string"},"error":{"type":"string"}}}}}}}}}}}