Chat and embeddings use their documented OpenAI-compatible shapes. Release-gated transcription uses a client-sealed JSON contract, not multipart upload.
API key + credits — create a key, top up credits once, send X-API-Key. Best for apps & agents. · x402 — per-request wallet payment via X-Payment. No setup.
POST /v1/audio/transcriptions/reserve → POST /v1/audio/transcriptionsLocal dictation processes audio on your device and defaults to Local. Grid is a separate, explicit paid choice: its selected provider receives the decrypted audio. Clients reserve a capability-qualified node using metadata and sample count, validate mono 16 kHz signed 16-bit PCM, then seal the audio locally before submitting a bounded JSON envelope. One request accepts at most 60 seconds. Billing uses exact PCM samples at $0.0001 per audio second ($0.006/minute), rounded up to micro-USDC with a $0.0001 minimum. A 4.2-second clip costs $0.000420. The route, catalogue, discovery, and provider listing remain off until the private canary and a capable provider pass.
https://grid.x402compute.cc·JSON APIs/v1/chat/completionsOpenAI-compatible chat. Pay per request via x402 (X-Payment) or prepaid credits.
/v1/modelsList currently-served models from active attested nodes.
/grid/modelsServed models with per-request pricing and node count.
/grid/capacityLive grid capacity: active nodes, TEE types, models.
/grid/jobsYour job history (auth by wallet address).
/grid/jobs/:idSingle job status and result.
| Code | Type | Description |
|---|---|---|
| 402 | Payment Required | Initial response; resend with X-Payment header. |
| 401 | Invalid API key | X-API-Key is unknown or revoked. |
| 402 | Insufficient credits | API key wallet has no prepaid credits. Top up in Settings → Credits. |
| 403 | Missing scope | API key lacks the grid:write scope. |
| 404 | Model not found | Model ID does not match any active node. |
| 429 | Rate limited | Per-wallet QPS exceeded. Backoff exponentially. |
| 503 | No nodes available | Temporary — all attested nodes for this model are saturated. |
from sgl_network import SGLClient
import os
client = SGLClient(private_key=os.environ["SOL_KEY"])
# x402 negotiates payment automatically
response = client.chat.completions.create(
model="llama-3.2-3b",
messages=[
{"role": "system", "content": "Be concise."},
{"role": "user", "content": "Explain TEEs in one sentence."}
],
temperature=0.7,
max_tokens=256,
)
print(response.choices[0].message.content)
print(f"Cost: ${response.usage.cost_usd:.4f}")
print(f"TX: {response.payment.signature}")