Docs
Base URL: https://pay.trustai.center/v1 · MCP: https://pay.trustai.center/mcp
Quick start (copy-paste)
Set export TAI_KEY=tai_… (from step 1 below; a $1 starter top-up is enough to try every model), or skip keys entirely with x402.
curl
curl https://pay.trustai.center/v1/chat/completions \
-H "Authorization: Bearer $TAI_KEY" -H 'Content-Type: application/json' \
-d '{"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":"Say hi"}],"max_tokens":200}'
OpenAI Python SDK
pip install openai
from openai import OpenAI
import os
client = OpenAI(base_url="https://pay.trustai.center/v1", api_key=os.environ["TAI_KEY"])
r = client.chat.completions.create(model="deepseek-v4.1-flash",
messages=[{"role": "user", "content": "Say hi"}], max_tokens=200)
print(r.choices[0].message.content)
OpenAI JS/TS SDK
npm i openai
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://pay.trustai.center/v1", apiKey: process.env.TAI_KEY });
const r = await client.chat.completions.create({ model: "deepseek-v4.1-flash",
messages: [{ role: "user", content: "Say hi" }], max_tokens: 200 });
console.log(r.choices[0].message.content);
MCP — Claude Desktop
claude_desktop_config.json (Claude Desktop connects to remote servers through the mcp-remote bridge; or add the URL under Settings → Connectors):
{"mcpServers":{"trustai":{"command":"npx","args":["-y","mcp-remote","https://pay.trustai.center/mcp","--header","Authorization:Bearer ${TAI_KEY}"],"env":{"TAI_KEY":"tai_…"}}}}
MCP — Cursor
~/.cursor/mcp.json (or .cursor/mcp.json in a project):
{"mcpServers":{"trustai":{"url":"https://pay.trustai.center/mcp","headers":{"Authorization":"Bearer tai_…"}}}}
No key yet? Omit headers: the create_topup tool returns a new key and a deposit address.
x402 client (no account, pay per request in USDC on Base)
npm i x402-fetch viem
import { wrapFetchWithPayment } from "x402-fetch";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(process.env.PRIVATE_KEY); // a Base wallet holding a little USDC
const pay = wrapFetchWithPayment(fetch, account);
const r = await pay("https://pay.trustai.center/v1/chat/completions", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ model: "gpt-oss-120b", messages: [{ role: "user", content: "Say hi" }], max_tokens: 1024 }) });
console.log((await r.json()).choices[0].message.content);
The client receives the 402, signs a USDC authorization for the quoted amount, and retries automatically. Settlement happens only if the completion succeeds.
1. Get a key and credits
curl -s https://pay.trustai.center/v1/topup -H 'Content-Type: application/json' \
-d '{"pack":1,"chain":"base","promo":"LAUNCH20"}'
# → {"order_id":"…","pay_to":"0x5beB…07cf","amount":"1.00xxxx","api_key":"tai_…", …}
Send exactly amount of the listed asset on that chain to pay_to (the exact amount identifies your order; orders expire after 120 min). Then:
curl -s https://pay.trustai.center/v1/topup/verify -H 'Content-Type: application/json' \
-d '{"order_id":"…","tx_hash":"0x…"}'
Chains: base (USDC), solana (USDC, send the signature as tx_hash), bsc (USDT or USDC, 18 decimals). Packs: 1 (starter), 3, 10, 25 USD. To top up an existing key, send Authorization: Bearer tai_….
Amounts: send the exact quoted amount for automatic crediting. Within -0.5% or $0.01 (or more than quoted), the amount actually received is credited (promo pro rata). Any other amount, or a transfer without an order: POST /v1/topup/claim {"chain","tx_hash","signature"}, where signature is the sending wallet signing trustai.center claim <chain>:<tx_hash> (EVM personal_sign / Solana signMessage). Max 7 days old; each transaction credits once. MCP: claim_topup.
2. Call the API
curl https://pay.trustai.center/v1/chat/completions \
-H "Authorization: Bearer $TAI_KEY" -H 'Content-Type: application/json' \
-d '{"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":"Hi"}],"max_tokens":200}'
Works with any OpenAI SDK (base_url="https://pay.trustai.center/v1"). stream: true returns SSE. Responses carry X-Trustai-Charged-Usd and X-Trustai-Balance-Usd. Credits are only debited after a successful response. Limits: 500 messages, 400,000 input chars (and within the model context), max_tokens up to 16,000 or the model maximum if lower (context.max_output_tokens in /v1/models; default 4,096). Before calling the model we check the key balance and limits against the worst-case cost of the request (input + full max_tokens); you are then billed actual tokens. Minimum $0.001 per request. Reasoning models (glm-5.3-flash, gpt-oss-120b) get max_tokens raised to at least 1024 so the answer is not empty; their thinking is returned in message.reasoning_content. JSON bodies are accepted with or without Content-Type: application/json.
3. Spend controls, balance and audit log
curl -s https://pay.trustai.center/v1/keys/limits -H "Authorization: Bearer $TAI_KEY" \
-H 'Content-Type: application/json' -d '{"spend_cap_usd":20,"daily_limit_usd":5,"per_request_max_usd":0.25}'
# omit a field to keep it, null removes it; daily limit resets 00:00 UTC
curl -s https://pay.trustai.center/v1/balance -H "Authorization: Bearer $TAI_KEY" # balance, spent, spent_today, limits
curl -s "https://pay.trustai.center/v1/usage?limit=50" -H "Authorization: Bearer $TAI_KEY" # charges, top-ups, last 24h
A request whose worst-case cost would exceed a limit is refused with 402 (per_request_limit, daily_limit_reached, spend_cap_reached) before any model call. POST /v1/keys/cap {"spend_cap_usd"} still works.
4. x402 (no key)
POST to /v1/chat/completions without a key: you get HTTP 402 with x402 v1 accepts (scheme exact, network base, USDC 0x8335…2913, payTo 0x5beB45770465cBd7BDb8517b64fB52F6dD6607cf). The price is the maximum cost of that exact request: input estimated at 2.5 chars/token (2 chars/token for CJK text) plus the full max_tokens. Re-send the same body with an X-PAYMENT header from any x402 client. We verify with a public facilitator, run the completion, and settle only if it succeeds; the result comes with X-PAYMENT-RESPONSE.
curl -si https://pay.trustai.center/v1/chat/completions -H 'Content-Type: application/json' \
-d '{"model":"gpt-oss-120b","messages":[{"role":"user","content":"Hi"}],"max_tokens":100}'
# HTTP/2 402 {"x402Version":1,"accepts":[{"scheme":"exact","network":"base","maxAmountRequired":"1000",…}]}
5. MCP
Remote server, streamable HTTP (stateless JSON): https://pay.trustai.center/mcp. Tools: list_models (servable chat models; include: "discovery" adds image/video), list_trending, get_balance, get_usage, set_cap (spend cap, daily limit, per-request max), create_topup (with promo), verify_topup, chat_completion, get_stats. Pass the key as Authorization: Bearer tai_… or as the api_key argument.
{"mcpServers":{"trustai":{"url":"https://pay.trustai.center/mcp","headers":{"Authorization":"Bearer tai_…"}}}}
Pricing: live per-model prices, refreshed daily. Models are sold at the model maker's list price (never more than 2% above it), with no subscription; every entry in /v1/models shows pricing.vs_list (e.g. "20% below list").
Trending models
Top models by tokens served in the last 24h across our inference network, refreshed daily. Full catalog: /v1/models (servable chat models only by default; ?include=discovery adds image/video models with servable:false; filters: ?modality=, &max_price=2, &sort=popularity|price, &q=qwen).
deepseek-v4.1-flash$0.15 in / $0.6 out per 1M · at list priceglm-5.3-flash$0.15 in / $0.5 out per 1M · at list priceqwen3-235b$0.9 in / $0.9 out per 1M · at list pricegpt-oss-120b$0.1 in / $0.5 out per 1M · at list pricedeepseek-v4.1-flash-1017$0.15 in / $0.6 out per 1M · at list priceqwen3.7-flash$0.03 in / $0.13 out per 1M · at list priceglm-4.7-flash$0.07 in / $0.4 out per 1M · at list pricekimi-k2-thinking$0.47 in / $2 out per 1M · at list pricellama-4-scout$0.1 in / $0.3 out per 1M · at list priceclaude-haiku-5.5$0.1 in / $0.5 out per 1M · at list price
Discovery
- /v1/models (prices) · /v1/status · /v1/pricing · /v1/stats (public usage, real DB numbers) · /status (/v1/health)
- Promo: send
"promo":"LAUNCH20"to/v1/topupfor +20% credits on a key's first top-up, until 1 Nov 2026 23:59 Paris time. - /llms.txt · /.well-known/trustai.json · /.well-known/mcp.json
Errors
| 401 | unknown key |
| 402 | insufficient_credit, spend_cap_reached, daily_limit_reached, per_request_limit, or x402 payment required/invalid |
| 503 | temporarily_unavailable — nothing charged, retry later |
No SDK package is published; use any OpenAI-compatible client. Keys cannot be recovered if lost. See terms.