//API Reference
Grid · API Reference

Grid APIs. Payment is auth.

Chat and embeddings use their documented OpenAI-compatible shapes. Release-gated transcription uses a client-sealed JSON contract, not multipart upload.

Two ways to pay for inference

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.

Release gatedPOST /v1/audio/transcriptions/reserve → POST /v1/audio/transcriptions
Whisper transcription is staged, not publicly available yet.

Local 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.

LivePOST /v1/systemone
Decision models: Singularity xMESH 0.8B

Send a state and up to 16 typed questions (noul, choice, or score). Each answer comes back with its type, the decision, and probabilities. Requests must fit the model's 2,048-token input. Billing is input-only at $0.01 per 1M tokens; output is free.

curl https://grid.x402compute.cc/v1/systemone \
  -H "Authorization: Bearer $SGL_API_KEY" -H "Content-Type: application/json" \
  -d '{"model":"singularity-layer/Singularity-xMESH-0.8B",
       "state":"Summarize a transcript and store the brief. Budget $0.05.",
       "questions":{
         "need_enrich":{"type":"noul","instructions":"Does the request need outside data?"},
         "pick_store":{"type":"choice","instructions":"Choose by capability, then price.",
           "criteria":{"storage_1":"cap=object storage; price=0.010","email_1":"cap=email; price=0.001"}}}}'
Base URLhttps://grid.x402compute.cc·JSON APIs

Endpoints

POST/v1/chat/completions

OpenAI-compatible chat. Pay per request via x402 (X-Payment) or prepaid credits.

GET/v1/models

List currently-served models from active attested nodes.

GET/grid/models

Served models with per-request pricing and node count.

GET/grid/capacity

Live grid capacity: active nodes, TEE types, models.

GET/grid/jobs

Your job history (auth by wallet address).

GET/grid/jobs/:id

Single job status and result.

Error codes

CodeTypeDescription
402Payment RequiredInitial response; resend with X-Payment header.
401Invalid API keyX-API-Key is unknown or revoked.
402Insufficient creditsAPI key wallet has no prepaid credits. Top up in Settings → Credits.
403Missing scopeAPI key lacks the grid:write scope.
404Model not foundModel ID does not match any active node.
429Rate limitedPer-wallet QPS exceeded. Backoff exponentially.
503No nodes availableTemporary — all attested nodes for this model are saturated.

Quickstart

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}")
▪ x402 PROTOCOL · Per-request payment. Wallet auth or API keys. Cancel anytime by stopping the request.