OpenAI compatible API · Attested · Public status

OpenRouter-Compatible Batch API Quickstart

Submit OpenRouter-compatible inline batches through the attested TrustedRouter gateway and poll encrypted results by batch ID.

Verify gateway
Onebase URL to migrate
100sof models and routes
0prompt or output logs. Always.
OpenRouter-compatible Batch API

Submit many requests. Poll one batch.

TrustedRouter implements the OpenRouter inline Batch API shape at /api/beta/batches. Existing integrations can switch the hostname and API key without uploading a JSONL file.

Batch items use the same attested authorization, routing, fallback, and integer billing as ordinary inference. When native execution is enabled for an eligible direct route, TrustedRouter uses that provider's Batch API and applies its published discount.

Create and pollPython
import os
import time
import requests

root = "https://api.trustedrouter.com"
headers = {
    "Authorization": f"Bearer {os.environ['TRUSTEDROUTER_API_KEY']}",
    "Content-Type": "application/json",
}

# Keep endpoint and model before requests.
created = requests.post(
    f"{root}/api/beta/batches",
    headers=headers,
    json={
        "endpoint": "/v1/chat/completions",
        "model": "deepseek/deepseek-v4-flash",
        "requests": [
            {
                "custom_id": "summary-001",
                "body": {
                    "messages": [{
                        "role": "user",
                        "content": "Reply exactly PONG",
                    }],
                    "max_tokens": 64,
                },
            }
        ],
    },
    timeout=30,
)
created.raise_for_status()
batch = created.json()

while batch["status"] not in {
    "completed", "failed", "expired", "cancelled"
}:
    time.sleep(5)
    response = requests.get(
        f"{root}/api/beta/batches/{batch['id']}",
        headers=headers,
        timeout=30,
    )
    response.raise_for_status()
    batch = response.json()

print(batch["results"])

Drop-in contract

Create

POST /api/beta/batches

Returns HTTP 202 with a batch_* ID, status, request counts, completion window, and aggregate usage fields.

Poll

GET /api/beta/batches/{id}

Poll with the same API key. A completed batch returns results inline in original request order.

Results

Response or error per item

Every result preserves custom_id and has either a response with status, request ID, and body, or a stable error.

“This model is only available through the Batch API”

If an integration returns This model is only available through the Batch API. Use the /api/beta/batches endpoint instead., the selected route requires asynchronous submission. Retrying the same model on the synchronous endpoint will not resolve that error.

Use the create-and-poll example above: send endpoint, model, and the inline requests array to POST /api/beta/batches. Poll the returned batch ID with the same API key until it reaches a terminal status, then inspect each item's response or error. Use a model ID available in the destination gateway's catalog.

If you need an immediate or streaming response, select a route that supports synchronous requests instead. Batch submission opts into the encrypted retention described below.

Native discounts

Use the provider's real Batch API.

When native execution is enabled, eligible direct OpenAI and Parasail chat or embedding jobs are uploaded by the attested gateway to that provider's native asynchronous Batch API. Both currently publish a 50% discount, which TrustedRouter applies with integer microdollar accounting after the provider completes each item.

If native submission is unsupported or a native item fails, TrustedRouter releases its native hold and runs that item through the ordinary attested fallback path at the selected fallback route's normal price.

Guardrails

No silent privacy downgrade

Native provider Batch APIs retain prompt and output content. TrustedRouter therefore keeps ZDR, E2E, confidential, EU, BYOK, custom, orchestration, and Broadcast-enabled jobs on the ordinary enclave-managed path.

Supported endpoints

One batch format across four APIs.

  • /v1/chat/completions
  • /v1/responses
  • /v1/messages
  • /v1/embeddings

Streaming is not available inside a batch. Embedding batches accept text, text arrays, token arrays, and arrays of token arrays. Provider preferences, input_type, and multimodal embedding inputs are rejected before the job is created.

Wire shapeJSON
{
  "endpoint": "/v1/responses",
  "model": "your/model",
  "requests": [
    {
      "custom_id": "task-001",
      "body": {
        "input": "Summarize this text.",
        "max_output_tokens": 300
      }
    }
  ]
}

Execution guarantees

Exactly-once settlement

Each item has a deterministic idempotency key. Worker restarts recover encrypted checkpoints instead of rerunning completed requests.

Regional lease safety

Workers claim jobs with generation-checked leases. Only one region executes an item while another region can recover an abandoned job.

Partial results

A provider or validation failure is attached to that item. Successful items remain successful and are billed once.

Confidential retention

Encrypted job state. No plaintext storage.

Submitting to the Batch API opts into temporary encrypted storage so jobs survive restarts and results can be polled. Prompts and outputs are encrypted inside the attested gateway with a per-artifact key. The raw API key is validated and discarded during submission; it is never persisted, even inside an encrypted artifact.

Under the deployed GCP IAM policy, only approved production enclave image digests are granted access to the ciphertext and its Cloud KMS envelope key. The control plane, object storage, logs, billing records, Sentry, and analytics do not receive plaintext batch content. Batch artifacts are automatically deleted after 30 days.

When an eligible job uses a provider-native Batch API, that provider receives and temporarily retains plaintext input for up to 26 hours and provider results for up to 6 hours after availability. This is why native Batch execution is never used for privacy-constrained aliases or requests.

This encrypted-retention boundary depends on GCP KMS, Cloud Storage, and the project's IAM administration. It is intentionally stronger than ordinary application-layer storage, but it is not the same zero-retention property as synchronous and streaming inference.

Ordinary synchronous and streaming inference remains content-stateless. Strict EU data-residency batch execution is not included in this first beta.

Verify the gateway Read the security boundary

Billing and limits

Native discount eligibility

Eligible OpenAI and Parasail native Batch items receive their published 50% discount when native execution is enabled. Managed fallback and providers without a verified native discount use normal route pricing. Read returned usage instead of assuming every item was discounted.

Current beta limits

  • 24-hour completion window
  • 32 MiB create request limit
  • 50,000 requests per batch
  • 64 MiB response limit per item
  • Unique custom_id values, up to 256 bytes
  • No list, cancel, or file-upload endpoints

Questions

Does TrustedRouter support the OpenRouter Batch API?

Yes. Submit an inline request to POST /api/beta/batches, then poll GET /api/beta/batches/{id} with the same API key. Switch the hostname and API key in an existing compatible integration; no JSONL upload is required.

Which endpoints can I use in a batch?

Batch items support Chat Completions, Responses, Anthropic Messages, and Embeddings. Streaming, file uploads, listing, and cancellation are not supported by this beta.

Does the Batch API retain prompts and outputs?

Batch is an opt-in encrypted-retention mode. Artifacts are encrypted inside the attested gateway and automatically deleted after 30 days. Eligible provider-native execution has an additional provider retention boundary; review the retention and eligibility details on this page before submitting sensitive content.

Workspace access

Sign in

Choose a sign in method to access your TrustedRouter workspace.

By signing in you agree to the terms of service and privacy policy.