Documentation

Everything you need to run private inference, verify results and build agents on Cerulyn.

Getting started

Overview

Cerulyn is a network of operator nodes that run AI models inside trusted execution environments (TEEs). Every response is signed by the enclave that produced it, and smaller models also produce a zkML proof of the computation.

You interact with the network through a REST API or the official SDKs. Payment happens per request, either from your account balance or with an x402 payment header.

Why it exists

When you call a hosted model today, you trust the provider twice. You trust that they will not read or keep your prompt, and you trust that the answer came from the model they named. Neither is something you can check.

Cerulyn removes both kinds of trust. Prompts are decrypted only inside sealed hardware that the operator cannot inspect, and each answer carries evidence of exactly which model and code produced it. That evidence can be checked by you, by your users, or by a smart contract.

What you get with every request

  • Confidentiality. Your input is encrypted to the enclave. Operators, Cerulyn staff and cloud providers see only ciphertext.
  • Integrity. The response is bound to a hashed model version and a measured node image. A swapped or modified model is detected.
  • Auditability. A commitment to the job is anchored on chain, so the result can be re-checked months later using only its job ID.

How the pieces fit

The sections below follow the path of a single request: how the network routes it, how you authenticate, how you call a model, and how anyone can verify the answer afterwards. If you want to try it first, jump to the Quickstart.

Cerulyn Network

When you submit a job, the scheduler picks an operator that meets your requested security tier and has the model cached. The operator runs the job in its enclave and returns the output with a TEE quote.

Security tiers

Every request names a tier. The tier decides what evidence comes back with the answer, and therefore how much you have to trust the hardware.

TierEvidence returnedBest for
teeSigned enclave quote binding the model hash, node image and output hash.Chat, agents and anything latency sensitive.
zkThe enclave quote plus a zkML proof of the forward pass. Available for models under 50M parameters.Oracles, risk models and results a contract will act on.

Lifecycle of a job

  1. Submit. Your client encrypts the request to the public key of an attested enclave and sends it to the gateway.
  2. Schedule. The scheduler picks an operator that supports the tier, has the model cached and has enough stake to cover a penalty.
  3. Execute. The enclave decrypts the request, runs the model and signs a quote over the model hash, node image and output hash.
  4. Prove. For the zk tier, a proof of the computation is generated. The output is returned first; the proof follows when it is ready.
  5. Anchor. Commitments for every job are batched and anchored on the Cerulyn chain every 30 seconds.

Operators and staking

Operators are independent machines that pass hardware attestation and post a bond. If a node returns a result it cannot back with a valid quote or proof, part of its bond is slashed. Honest operators earn the fees for the jobs they run.

Settlement chain

The chain is EVM compatible, so contracts can check a result directly. A contract receives the output and the job ID, looks up the commitment, and acts only if it matches.

Quickstart

This takes about five minutes. You need Python 3.9 or newer, or Node.js 18 or newer, and an API key from the portal.

1. Install the SDK

pip install cerulyn

2. Set your key

Store the key in an environment variable so it never ends up in your code or your repository.

Shell
export CERULYN_KEY="crl_live_..."

3. Send your first private request

import os, cerulyn

client = cerulyn.Client(api_key=os.environ["CERULYN_KEY"])

res = client.chat(
    model="cerulyn/llama-3.1-8b-tee",
    messages=[{"role": "user", "content": "Summarize this contract."}],
    tier="tee",
)

print(res.text)
print(res.attestation.verify())  # True

4. Keep the job ID

Every response has an id such as job_7Qm2c9. Save it next to the output in your database. With the ID alone, you or anyone else can verify the answer later, even if the original response is lost.

Next steps

  • Read Run inference for streaming, system prompts and embeddings.
  • Read Verify a result to check answers in your own backend or in a contract.
  • Browse the Model Vault to pick a model for your use case.

Authentication

Requests are authenticated with an API key sent as a bearer token. Keys start with crl_live_ for mainnet and crl_test_ for testnet.

HTTP header
Authorization: Bearer crl_live_...

Key scopes

Give each key only what it needs. A key that only verifies results cannot spend your balance.

ScopeAllows
inferenceCall /chat, /embed and /infer, billed to your balance.
readRead jobs, attestations and the model list. No spending.
memoryCreate, read and delete stored memories.

Rotating and revoking keys

Create a new key in the portal, deploy it, then revoke the old one. Revocation takes effect within a minute. If a key leaks, revoke it first and investigate afterwards; usage made with a revoked key is never billed.

Paying without a key (x402)

Agents and browser apps should not hold long-lived secrets. With x402, a request without credentials receives a 402 response and a price quote. The client signs a payment for that exact quote and retries. Spending is capped per request by design.

Keep keys on the server. For browser or agent use, prefer x402 payments, which need no long-lived secret. Keys are created in the portal. Request portal access

Guides

Run inference

The chat endpoint follows the familiar messages format. Add tier to choose the security level.

curl https://api.cerulyn.dev/v1/chat \
  -H "Authorization: Bearer $CERULYN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "cerulyn/llama-3.1-8b-tee",
    "tier": "tee",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

Request parameters

FieldTypeDescription
modelstringRequired. A model ID from the Vault, optionally pinned with @hash.
messagesarrayRequired. Objects with role (system, user or assistant) and content.
tierstringtee (default) or zk where the model supports it.
max_tokensintegerUpper limit on the length of the answer.
temperaturenumber0 to 2. Lower values give more predictable answers.
streambooleanSend the answer as server-sent events while it is generated.
memory_idstringAttach a stored memory. It is decrypted only inside the enclave.

Streaming

With stream set to true, tokens arrive as they are produced. The attestation is sent in the final event, after the full output has been hashed, so always wait for the last event before you treat the answer as verified.

Python
for event in client.chat(model="cerulyn/llama-3.1-8b-tee", messages=msgs, stream=True):
    if event.type == "token":
        print(event.text, end="")
    elif event.type == "done":
        assert event.attestation.verify()

Embeddings and other models

Use /embed to turn text into vectors for search, and /infer for models that are not chat models, such as forecasting or classification. Both return the same attestation object, so verification works the same way.

Tips

  • Pin a model hash in production. A pinned request never silently switches to a newer version.
  • Put stable instructions in a system message rather than repeating them in every user message.
  • Use the zk tier only where a contract or third party needs the proof; it adds latency.

Verify a result

Verification checks three things: the quote was signed by genuine hardware, the measured enclave runs the published node image, and the hash of the output matches the one in the quote.

The SDK does all three with attestation.verify(). Anyone can repeat the check later using only the job ID:

Python
cerulyn.verify_job("job_7Qm2c9")  # fetches the on-chain commitment and checks it

What each check proves

CheckProvesFails when
Hardware signatureThe quote came from a real, up-to-date enclave.The quote is forged or the hardware has a revoked key.
Node measurementThe enclave ran the published, open-source node image.The operator modified the software.
Output hashThe text you received is exactly what the enclave produced.The answer was changed after it left the enclave.
Model hashThe answer came from the model version you asked for.A different or modified model was used.

Verifying in a smart contract

Contracts on the settlement chain can call the verifier directly. Pass the job ID and the output hash; the call returns true only if the commitment exists and matches.

Solidity
interface ICerulynVerifier {
    function verify(bytes32 jobId, bytes32 outputHash) external view returns (bool);
}

require(verifier.verify(jobId, keccak256(output)), "unverified result");

Verifying without the SDK

The verification steps are documented and the reference verifier is open source, so you can implement the same checks in any language. You need the job record from GET /jobs/{id} and the published list of trusted node image measurements.

A failed verification is a signal, not a crash. Log it, do not show the answer to the user, and retry the request. Repeated failures from one operator are reported to the network automatically.

Model Vault

Every model in the Vault is identified by a content hash and signed by its publisher. Pricing will be published before paid usage opens. Models planned for launch:

ModelContextTiersUse for
cerulyn/llama-3.1-8b-tee128kteeFast chat and agents
cerulyn/qwen-2.5-72b-tee128kteeHarder reasoning and long documents
cerulyn/mistral-small-tee32kteeLow-cost general tasks
cerulyn/vol-forecast-v2n/atee zkVolatility forecasts for DeFi
cerulyn/embed-small8ktee zkSearch and retrieval

Model IDs and versions

A model ID has the form publisher/name. Each upload creates a new version with its own content hash. Calling cerulyn/embed-small uses the latest version; calling cerulyn/embed-small@0x3b1e... always uses that exact version.

Choosing a model

  • Start with the smallest model that does the job well. Smaller models answer faster and cost less.
  • Pick a model with zk support if the result will be read by a contract.
  • Test with your own examples. Use GET /models to list everything available for your tier.

Publishing a model

Publishers upload weights together with a manifest that lists the architecture, tokenizer and licence. The Vault computes the content hash, the publisher signs it, and the model becomes callable once operators have cached it. Weights can be stored encrypted so that only enclaves can load them.

Reference

API reference

Base URL: https://api.cerulyn.dev/v1. All requests and responses use JSON, and all timestamps are UTC in ISO 8601 format.

EndpointDescription
POST/chatRun a chat completion inside a TEE.
POST/embedCreate embeddings.
POST/inferRun a non-LLM model from the Vault.
GET/jobs/{id}Fetch a job with its attestation and proof status.
GET/modelsList models, filterable by tier.
GET/models/{id}Show the versions, hashes and tiers of one model.
POST/memoryCreate an encrypted memory owned by the caller.
DELETE/memory/{id}Erase a stored memory permanently.

The job object

Returned by GET /jobs/{id}. The proof field is pending until a zk proof is ready, and null for the tee tier.

JSON
{
  "id": "job_7Qm2c9",
  "model": "cerulyn/llama-3.1-8b-tee@0x51d0...4a",
  "tier": "tee",
  "created_at": "2026-11-18T09:14:03Z",
  "output_hash": "0x9c1f...27",
  "attestation": { "enclave": "sgx-tdx", "quote": "0x04a1...e9" },
  "proof": null,
  "anchored_in_block": 4182207
}

Pagination

List endpoints return up to 50 items and a next_cursor. Pass it as ?cursor= to fetch the next page. When next_cursor is null, you have reached the end.

x402 payments

For x402 payments, omit the Authorization header. The API responds with 402 and a quote in X-Payment-Quote. Retry with a signed X-Payment header. Quotes expire after 60 seconds.

Idempotency

Send an Idempotency-Key header with any POST request. If a network error makes you retry, the same key returns the original job instead of running and billing it twice.

Errors and limits

Errors use standard HTTP status codes and always return a JSON body with a stable code you can match on, and a human-readable message.

JSON
{
  "error": {
    "code": "tier_unavailable",
    "message": "No operator is currently serving this model on the zk tier.",
    "request_id": "req_d81k2x"
  }
}
CodeMeaningWhat to do
400Invalid request body.Check field names and types. Do not retry unchanged.
401Missing or invalid API key.Check the key and its scope.
402Payment required (x402 flow).Sign the quote and retry.
404Unknown model or job.Check the ID and, for models, the pinned hash.
409Idempotency key reused with a different body.Use a new key for a new request.
429Rate limit reached. Default: 600 requests per minute per key.Wait for the time in Retry-After.
503No operator available for the requested tier.Retry with backoff, or fall back to the tee tier.

Rate limit headers

Every response includes X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. Read them to slow down before you hit the limit rather than after.

Retrying safely

Retry 429 and 503 with exponential backoff: wait about 1 second, then 2, then 4, adding a little random jitter, and stop after five attempts. Always send an Idempotency-Key so a retry can never be billed twice.

Size limits

  • Request body: 4 MB.
  • Messages per request: 256.
  • Output length: limited by the model context and your max_tokens.

Include the request_id when you contact support. It lets us find the request without ever seeing its content.

Network status

Live uptime for each component will be shown here once the public network opens.

Each row tracks one part of the system. When something is degraded, this page will say which part, what is affected and when it was last updated.

What each component does

  • API gateway: receives requests, checks keys and payments, and routes jobs.
  • Inference (TEE tier): the operator nodes that run models inside enclaves.
  • Proof generation (zk tier): the workers that produce zkML proofs after a job completes.
  • Settlement chain: records job commitments and handles payments and staking.
  • Portal: the web dashboard for keys, usage and billing.

During an incident

If the proof workers are slow, tee answers still return normally and proofs catch up afterwards. If no operator is available for a tier, the API returns 503 instead of quietly running your job somewhere weaker.

Changelog

Changes to the API and SDKs. Breaking changes are announced at least 30 days in advance on the blog.

v2.0.0 · November 18, 2026

  • Mainnet launch. Open operator set with staking.
  • New network="mainnet" option in both SDKs.
  • Job commitments are now anchored every 30 seconds.

v1.9.0 · November 4, 2026

  • x402 payments on all public models.
  • New Idempotency-Key header for POST requests.

v1.8.2 · October 14, 2026

  • Faster attestation verification in the TypeScript SDK.
  • Clearer error messages when a pinned model hash does not exist.