Skip to content

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.

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)"

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"},...]}

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}}

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}}

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]

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_start
data: {"type":"message_start","message":{"id":"msg_b9f3e0dedf27c45d05c7bd7b","type":"message","role":"assistant","model":"glm-5.3","content":[],...}}
event: content_block_start
data: {"type":"content_block_start","index":0,"content_block":{"type":"thinking","signature":""}}
event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"thinking_delta","thinking":"The"}}
...
event: content_block_delta
data: {"type":"content_block_delta","index":1,"delta":{"type":"text_delta","text":"1, 2"}}
...
event: message_stop
data: {"type":"message_stop"}

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-login
Stored 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:

call_model.py
import json
import 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.py
cere egress log --sandbox $ID
cere sandbox terminate $ID
Hello, how are you today?
TIME SANDBOX DECISION METHOD HOST PATH STATUS CREDENTIAL DOWN MS REASON
2026-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.

The agents in Agents reach their model the same way. For egress rules and secrets in general, see Egress and secrets.

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.