Skip to content
portal

07.2 · API

Compute HTTP

OpenAI-compatible chat completions, plus the trust-mode header.

Private Computer issues the API key at pc.0g.ai. The OpenAI-compatible base URL published for 0G hacker environments is router-api.0g.ai/v1. If the dashboard shows a different base URL, the dashboard wins.

Credit pays this call. Gas does not. A 401 is the key. A payment error is the ledger. Trust mode is optional and defaults to standard.

01

/chat/completions

POSTOne chat completion. The body matches the OpenAI SDK.

Request
POST https://router-api.0g.ai/v1/chat/completions
Authorization: Bearer $ZG_API_KEY
Content-Type: application/json
X-0G-Provider-Trust-Mode: standard

{
  "model": "0GM-1.0-35B-A3B",
  "messages": [
    { "role": "user", "content": "Say hello from 0G." }
  ]
}
Response
{
  "choices": [
    { "message": { "role": "assistant", "content": "Hello from 0G." } }
  ]
}
  • standard reaches the widest set of models and providers. verified limits routing to attested providers and can return a proof of that route. private is the TEE path for prompts that should not be visible to the provider.
  • TeeTLS attests routing. TeeML attests that the model ran inside an enclave. Most models are not TeeML. Do not document a blanket “this ran in a TEE.”
  • Set the header to verified or private only when the model catalog says that mode exists for the model.
  • The broker alternative is not this HTTP shape. 0g-compute-cli get-secret gives you an app-sk key and a service URL. Call {service}/v1/proxy with that key.