Inference API
The inference gateway, https://inference-gateway.compute.dev.ddcdragon.com, serves models through an
OpenAI-compatible API at /openai/v1 and an Anthropic-compatible API at /anthropic. Point an OpenAI or Anthropic
client at it with a key for your bucket; the calls are billed to that bucket.
Get a key
Section titled “Get a key”The key is a COMPUTE token for your bucket, the same kind of token the cere CLI signs in with. Create one in the
Developer Console:
- Inference > API keys > Create key: 7, 30 or 90 days;
- Access tokens > A token for CI: 1, 7 or 30 days.
Either is shown once, cannot be revoked, and lets whoever holds it spend from your bucket until it expires. The
examples on this page read it from CERE_TOKEN:
export CERE_TOKEN="$(cat token.txt)"List models
Section titled “List models”GET /openai/v1/models lists the models you can call (GET /anthropic/v1/models lists the same in Anthropic’s
shape). Each has an id, <bucket>/<name>/<version>, and an alias; a request names either. The examples on this page
use glm-5.3.
curl -s https://inference-gateway.compute.dev.ddcdragon.com/openai/v1/models \ -H "Authorization: Bearer $CERE_TOKEN"{"object":"list","data":[{"id":"1338/emotion-english-distilroberta-base/v1.0.2","object":"model","created":0,"owned_by":"ddc","alias":"emotion-english-distilroberta-base"},{"id":"1338/gemma4_31b/v1.0.0","object":"model","created":0,"owned_by":"ddc","alias":"gemma4_31b"},{"id":"1338/glm-5.3/v1.0.0","object":"model","created":0,"owned_by":"ddc","alias":"glm-5.3"},...]}import os
from openai import OpenAI
client = OpenAI( base_url="https://inference-gateway.compute.dev.ddcdragon.com/openai/v1", api_key=os.environ["CERE_TOKEN"],)for model in client.models.list(): print(model.id)1338/emotion-english-distilroberta-base/v1.0.21338/gemma4_31b/v1.0.01338/glm-5.3/v1.0.01338/glm-5.3-flash/v1.0.01338/parakeet-tdt-0.6b-v2/v1.0.01338/parakeet-tdt-0.6b-v3/v1.0.01338/pyannote-segmentation-3.0/v1.3.21338/qwen3-embedding-4b/v1.0.01338/qwen38_27b/v1.0.41338/ser-odyssey-wavlm/v1.1.01338/titanet-large/v1.0.01338/wavlm-authenticity/v0.1.0import OpenAI from 'openai';
const client = new OpenAI({ baseURL: 'https://inference-gateway.compute.dev.ddcdragon.com/openai/v1', apiKey: process.env.CERE_TOKEN,});for await (const model of client.models.list()) { console.log(model.id);}1338/emotion-english-distilroberta-base/v1.0.21338/gemma4_31b/v1.0.01338/glm-5.3/v1.0.01338/glm-5.3-flash/v1.0.01338/parakeet-tdt-0.6b-v2/v1.0.01338/parakeet-tdt-0.6b-v3/v1.0.01338/pyannote-segmentation-3.0/v1.3.21338/qwen3-embedding-4b/v1.0.01338/qwen38_27b/v1.0.41338/ser-odyssey-wavlm/v1.1.01338/titanet-large/v1.0.01338/wavlm-authenticity/v0.1.0Chat completions (OpenAI-compatible)
Section titled “Chat completions (OpenAI-compatible)”POST /openai/v1/chat/completions takes an OpenAI chat request. With the openai package (pip install openai,
npm install openai), the base URL ends in /openai/v1.
curl -s https://inference-gateway.compute.dev.ddcdragon.com/openai/v1/chat/completions \ -H "Authorization: Bearer $CERE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"model": "glm-5.3", "messages": [{"role": "user", "content": "Say hello in five words."}]}'{"id":"chatcmpl-37952d89142b5ff9471c1c9b","object":"chat.completion","created":1795623171,"model":"glm-5.3","choices":[{"index":0,"message":{"role":"assistant","content":"Hello, nice to see you!","reasoning_content":"The user wants me to say hello in exactly five words. ..."},"finish_reason":"stop"}],"usage":{"prompt_tokens":18,"completion_tokens":308,"total_tokens":326}}import os
from openai import OpenAI
client = OpenAI( base_url="https://inference-gateway.compute.dev.ddcdragon.com/openai/v1", api_key=os.environ["CERE_TOKEN"],)reply = client.chat.completions.create( model="glm-5.3", messages=[{"role": "user", "content": "Say hello in five words."}],)print(reply.choices[0].message.content)print(reply.usage.prompt_tokens, reply.usage.completion_tokens)Hello there, my dear friend!18 274import OpenAI from 'openai';
const client = new OpenAI({ baseURL: 'https://inference-gateway.compute.dev.ddcdragon.com/openai/v1', apiKey: process.env.CERE_TOKEN,});const reply = await client.chat.completions.create({ model: 'glm-5.3', messages: [{ role: 'user', content: 'Say hello in five words.' }],});console.log(reply.choices[0].message.content);console.log(reply.usage.prompt_tokens, reply.usage.completion_tokens);Hello there, wonderful human being!18 628Messages (Anthropic-compatible)
Section titled “Messages (Anthropic-compatible)”POST /anthropic/v1/messages takes an Anthropic Messages request. With the anthropic package
(pip install anthropic, npm install @anthropic-ai/sdk), the base URL ends in /anthropic: the client adds
/v1/messages itself.
curl -s https://inference-gateway.compute.dev.ddcdragon.com/anthropic/v1/messages \ -H "Authorization: Bearer $CERE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"model": "glm-5.3", "max_tokens": 256, "messages": [{"role": "user", "content": "Say hello in five words."}]}'{"id":"msg_f1ad701c930a68e823986bf8","type":"message","role":"assistant","model":"glm-5.3","content":[{"type":"thinking","thinking":"The user wants me to say hello in exactly five words. ...","signature":""},{"type":"text","text":"Hello, how are you today?"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":18,"output_tokens":228,"cache_creation_input_tokens":0,"cache_read_input_tokens":0}}import os
from anthropic import Anthropic
client = Anthropic( base_url="https://inference-gateway.compute.dev.ddcdragon.com/anthropic", api_key=os.environ["CERE_TOKEN"],)msg = client.messages.create( model="glm-5.3", max_tokens=256, messages=[{"role": "user", "content": "Say hello in five words."}],)print(msg.content[-1].text)print(msg.usage.input_tokens, msg.usage.output_tokens)Hello there, how are you?18 168import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({ baseURL: 'https://inference-gateway.compute.dev.ddcdragon.com/anthropic', apiKey: process.env.CERE_TOKEN,});const msg = await client.messages.create({ model: 'glm-5.3', max_tokens: 256, messages: [{ role: 'user', content: 'Say hello in five words.' }],});console.log(msg.content.at(-1).text);console.log(msg.usage.input_tokens, msg.usage.output_tokens);Hello, how are you today?18 250Stream the response
Section titled “Stream the response”Set "stream": true (or use the client’s streaming call) to get the answer as server-sent events while the model
writes it.
curl -sN https://inference-gateway.compute.dev.ddcdragon.com/openai/v1/chat/completions \ -H "Authorization: Bearer $CERE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"model": "glm-5.3", "stream": true, "messages": [{"role": "user", "content": "Count from 1 to 5."}]}'data: {"id":"chatcmpl-d755a83a39f3c145838edb58","object":"chat.completion.chunk","created":1795623273,"model":"glm-5.3","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}
data: {"id":"chatcmpl-d755a83a39f3c145838edb58","object":"chat.completion.chunk","created":1795623273,"model":"glm-5.3","choices":[{"index":0,"delta":{"reasoning_content":"The"},"finish_reason":null}]}
...
data: {"id":"chatcmpl-d755a83a39f3c145838edb58","object":"chat.completion.chunk","created":1795623273,"model":"glm-5.3","choices":[{"index":0,"delta":{"content":"1, 2,"},"finish_reason":null}]}
...
data: {"id":"chatcmpl-d755a83a39f3c145838edb58","object":"chat.completion.chunk","created":1795623273,"model":"glm-5.3","choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":{"prompt_tokens":20,"completion_tokens":44,"total_tokens":64}}
data: [DONE]import os
from openai import OpenAI
client = OpenAI( base_url="https://inference-gateway.compute.dev.ddcdragon.com/openai/v1", api_key=os.environ["CERE_TOKEN"],)stream = client.chat.completions.create( model="glm-5.3", messages=[{"role": "user", "content": "Count from 1 to 5."}], stream=True,)for chunk in stream: if chunk.choices and chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="", flush=True)print()1, 2, 3, 4, 5.import OpenAI from 'openai';
const client = new OpenAI({ baseURL: 'https://inference-gateway.compute.dev.ddcdragon.com/openai/v1', apiKey: process.env.CERE_TOKEN,});const stream = await client.chat.completions.create({ model: 'glm-5.3', messages: [{ role: 'user', content: 'Count from 1 to 5.' }], stream: true,});for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? '');}process.stdout.write('\n');1, 2, 3, 4, 5.The Anthropic API streams with "stream": true too, as Anthropic’s events:
curl -sN https://inference-gateway.compute.dev.ddcdragon.com/anthropic/v1/messages \ -H "Authorization: Bearer $CERE_TOKEN" \ -H "Content-Type: application/json" \ -d '{"model": "glm-5.3", "max_tokens": 256, "stream": true, "messages": [{"role": "user", "content": "Count from 1 to 5."}]}'event: message_startdata: {"type":"message_start","message":{"id":"msg_b9f3e0dedf27c45d05c7bd7b","type":"message","role":"assistant","model":"glm-5.3","content":[],...}}
event: content_block_startdata: {"type":"content_block_start","index":0,"content_block":{"type":"thinking","signature":""}}
event: content_block_deltadata: {"type":"content_block_delta","index":0,"delta":{"type":"thinking_delta","thinking":"The"}}
...
event: content_block_deltadata: {"type":"content_block_delta","index":1,"delta":{"type":"text_delta","text":"1, 2"}}
...
event: message_stopdata: {"type":"message_stop"}import os
from anthropic import Anthropic
client = Anthropic( base_url="https://inference-gateway.compute.dev.ddcdragon.com/anthropic", api_key=os.environ["CERE_TOKEN"],)stream = client.messages.create( model="glm-5.3", max_tokens=256, messages=[{"role": "user", "content": "Count from 1 to 5."}], stream=True,)for event in stream: if event.type == "content_block_delta" and event.delta.type == "text_delta": print(event.delta.text, end="", flush=True)print()1, 2, 3, 4, 5import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({ baseURL: 'https://inference-gateway.compute.dev.ddcdragon.com/anthropic', apiKey: process.env.CERE_TOKEN,});const stream = client.messages.stream({ model: 'glm-5.3', max_tokens: 256, messages: [{ role: 'user', content: 'Count from 1 to 5.' }],});stream.on('text', (text) => process.stdout.write(text));await stream.finalMessage();process.stdout.write('\n');1, 2, 3, 4, 5Call a model from a sandbox
Section titled “Call a model from a sandbox”A sandbox reaches the gateway through the egress proxy, which adds your key to its requests; the sandbox holds only a placeholder. Store your login token as a secret bound to the gateway’s host, once:
cere secret set ddc-inference --from-loginStored secret ddc-inference (header Authorization): your login token for bucket <bucket-id>, sent only to inference-gateway.compute.dev.ddcdragon.com.It stops working when that token expires, 2026-12-24T21:57:01Z (in 29d05h); after your next cere login, run this again.Then allow the gateway with that secret, and call it with any key: the proxy replaces the Authorization header.
This script uses only Python’s standard library:
import jsonimport urllib.request
req = urllib.request.Request( "https://inference-gateway.compute.dev.ddcdragon.com/openai/v1/chat/completions", data=json.dumps({ "model": "glm-5.3", "messages": [{"role": "user", "content": "Say hello in five words."}], }).encode(), headers={"Authorization": "Bearer placeholder", "Content-Type": "application/json"},)with urllib.request.urlopen(req, timeout=120) as r: print(json.load(r)["choices"][0]["message"]["content"])ID=$(cere sandbox create --image python:3.12-slim --timeout 300 -q \ --allow inference-gateway.compute.dev.ddcdragon.com:POST:/openai/v1:ddc-inference)cere sandbox exec $ID --stdin -- python - < call_model.pycere egress log --sandbox $IDcere sandbox terminate $IDHello, how are you today?TIME SANDBOX DECISION METHOD HOST PATH STATUS CREDENTIAL DOWN MS REASON2026-11-25T16:20:10Z sb-01m89r3p4fy9313273mw9y3s8e allowed POST inference-gateway.compute.dev.ddcdragon.com /openai/v1/chat/completions 200 ddc-inference 836 B 2550 -sb-01m89r3p4fy9313273mw9y3s8e terminated: terminated by API...The egress log can take a few seconds to show a request.
import cere
sb = cere.Sandbox.create( image="python:3.12-slim", timeout=300, egress=[cere.Allow("inference-gateway.compute.dev.ddcdragon.com", ["POST"], "/openai/v1", "ddc-inference")],)p = sb.exec("python", "-c", open("call_model.py").read())print(p.stdout.read(), end="")sb.terminate()Hello there, how are you?The agents in Agents reach their model the same way. For egress rules and secrets in general, see Egress and secrets.
Limits and errors
Section titled “Limits and errors”Your bucket may have 8 requests in flight on each model at once. GET /api/v1/limits shows your bucket’s limit on
each model, how many of its requests are in flight now, and the model’s own capacity:
curl -s https://inference-gateway.compute.dev.ddcdragon.com/api/v1/limits -H "Authorization: Bearer $CERE_TOKEN"{"bucket":<bucket-id>,"profile":"default","scope":"cluster","enabled":true,"models":[...,{"model":"1338/glm-5.3/v1.0.0","alias":"glm-5.3","limit":{"maxInFlight":8},"inFlight":3,"modelStatus":{"status":"available","ceiling":16,"inFlight":3}},...]}A request over the limit is refused at once; it does not wait. Errors come in the envelope of the API you called, with the types the OpenAI and Anthropic clients recognise:
| Status | OpenAI type (code) |
Anthropic type |
Meaning |
|---|---|---|---|
| 401 | invalid_request_error (invalid_api_key) |
authentication_error |
The key is missing, malformed or expired. |
| 403 | invalid_request_error (insufficient_permissions) |
permission_error |
The key does not grant COMPUTE on a bucket its signer owns, or the bucket’s owner has no balance left. |
| 404 | invalid_request_error (model_not_found) |
not_found_error |
No node serves the model now: a wrong name, or a model that is briefly unavailable. |
| 429 | rate_limit_error (rate_limit_exceeded) |
rate_limit_error |
Your bucket has 8 requests in flight on the model, or the model is at capacity. Wait, or send fewer at once. |
| 502 | server_error (upstream_error) |
api_error |
A service behind the model failed. Retry. |
| 503 | server_error (overloaded or service_unavailable) |
api_error |
The model is saturated right now, or has no capacity. Retry with backoff. |
| 529 | overloaded_error |
The Anthropic API’s status for a saturated model. Retry with backoff. | |
| 504 | server_error (timeout) |
timeout_error |
The inference ran out of time. |
A refusal carries a Retry-After header when the gateway can tell how long to wait. For example:
curl -s https://inference-gateway.compute.dev.ddcdragon.com/openai/v1/chat/completions \ -H "Authorization: Bearer not-a-token" \ -H "Content-Type: application/json" \ -d '{"model": "glm-5.3", "messages": [{"role": "user", "content": "hi"}]}'{"error":{"code":"invalid_api_key","message":"malformed auth token","param":null,"type":"invalid_request_error"}}and a saturated model on the Anthropic API (status 529):
{"type":"error","error":{"type":"overloaded_error","message":"inference failed: remote: no account can serve glm-5.3 right now"},"request_id":"69153fdf-ab78-4266-9a00-b52dc96a4117"}Model calls are billed to the bucket the key belongs to, at the model’s price per million input and output tokens. Developer Console > Inference > Models shows each model’s price and your balance, and Usage shows what your bucket used.