API Reference
Complete API documentation for all available models. Select a service type and model to view endpoints, code examples, and additional features.
Select Service Type & Model
Complete API documentation for all available models. Select a service type and model to view endpoints, code examples, and additional features.
Select Service Type & Model
Context Length
2,048
Max Output
--
Input Price
0.0937 0G/image
Output Price
--
Providers
1
Type
Image Generation
0G Router normalizes requests and responses across providers for you. All endpoints follow the OpenAI API format.
Async API — Image generation uses an asynchronous flow: submit a job, then poll for the result. The examples below show both steps.
Submit Endpoint
Poll Endpoint
Code Examples
# 1. Submit async job
curl https://router-api.0g.ai/v1/async/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-d '{
"model": "z-image",
"prompt": "A futuristic city skyline at sunset",
"n": 1,
"size": "1024x1024",
"response_format": "b64_json"
}'
# Response: {"jobId": "abc123", "status": "pending", "provider_address": "0x..."}
# 2. Poll for result (repeat until status is "completed")
curl "https://router-api.0g.ai/v1/async/jobs/<JOB_ID>?provider_address=<PROVIDER_ADDRESS>&model=z-image" \
-H "Authorization: Bearer <YOUR_API_KEY>"TEE Verification
If the provider runs inside a TEE (Trusted Execution Environment), you can request on-chain signature verification by setting verify_tee. The response will include a tee_verified field in the trace.
# Add verify_tee in the JSON body
{
"model": "z-image",
"prompt": "A futuristic city skyline at sunset",
"verify_tee": true
}
# Then poll with verify_tee query param
curl "https://router-api.0g.ai/v1/async/jobs/<JOB_ID>?provider_address=<ADDR>&model=z-image&verify_tee=true" \
-H "Authorization: Bearer <YOUR_API_KEY>"