Pick your integration
See Developer Experience for both, in detail. For an agent that runs continuously, run the Confidential Proxy as a background daemon rather than in the foreground:
start / stop / status, PID and log files, graceful shutdown).
Required configuration
Both confidential integration paths need the same four values. Set them once in the environment where the agent runs, not for each call:
Get the current
PROXY_URL / ENCLAVE_URL values from dashboard.prem.io/endpoints.json at deploy time rather than hardcoding them.
ZDR uses the same PREM_API_KEY at https://gateway.prem.io/openai. See ZDR overview for the ZDR setup.
Gotchas that only show up at automation scale
These are easy to miss in a one-off script and expensive to miss in a loop that runs thousands of times.Reasoning is on by default and is billed
Reasoning is on by default and is billed
Reasoning models generate a chain-of-thought before every answer unless you turn it off.
Those tokens are billed, count against your rate limit, and share the same inference’s token budget as the visible answer. Reasoning can consume a tight
max_completion_tokens value and leave message.content: null.Default to the lowest reasoning_effort value that the model family accepts in automated pipelines unless you explicitly consume the reasoning trace. See Models & Pricing for the values that each family accepts.Concurrent requests have a limit for each API key
Concurrent requests have a limit for each API key
Prem limits the number of inference requests that one API key can process at the same time. The limit applies to every inference endpoint. A call above the limit returns The limit is most visible on the encrypted
429 with:/rvenc/chat/completions endpoint, which the TypeScript SDK uses. That endpoint always responds over text/event-stream, even when you do not set stream: true. A call to it holds its slot until the stream closes. See Tiers. If your agent sends calls in parallel on one key, send them in sequence or supply a different API key to each worker.429 responses don't all look the same
429 responses don't all look the same
Some
429 responses have a structured body and a Retry-After header. Others, such as a rate limit upstream of Prem, return a generic body with no Retry-After header. Branch on the HTTP status code, not the body shape. Use your own exponential backoff when the header is not there. See Rate limits.Retries need to be idempotent
Retries need to be idempotent
An agent that retries blindly after a timeout or a
5xx can duplicate the underlying action (a file upload, a resource creation). Send an Idempotency-Key header so a retried request has the same effect as the original. See Idempotency.Check finish_reason and content
Check finish_reason and content
A
null or empty message.content is not necessarily a failed call. If finish_reason is "length", reasoning, a long answer, or both consumed the token budget. Treat it as truncation and retry with a larger max_completion_tokens or a lower reasoning_effort, not as an empty result to discard.A request shaped for unattended use
Before you deploy
-
reasoning_effortset deliberately (the lowest value the model family accepts, or a value you’ve budgetedmax_completion_tokensfor) - Retries use exponential backoff and don’t assume
Retry-Afteris present - Idempotency keys on any retried write
- Concurrent calls on the same API key are serialized, or spread across multiple keys
- Every response checks
finish_reasonbefore treatingcontentas final -
support_idis logged on every error for support escalation
This checklist is agent-specific. For the full production checklist (key management, tiers, attestation), see Production Checklist.
Related
Tiers
The request, token, and audio limits of each tier.
Rate limits
Retry code, the 429 shapes, and non-standard 429 bodies.
Idempotency
Make retries safe with the Idempotency-Key header.
Confidential Proxy
Daemon mode, config, and connecting any language.
OpenCode
Connect OpenCode to Prem API through the local proxy.
OpenClaw
Configure a Prem-backed OpenClaw provider and its tool boundary.
Hermes Agent
Use an explicit Chat Completions transport through Prem.
Goose
Connect Goose’s built-in OpenAI provider to Prem.
Cursor compatibility
Review why Cursor’s provider override is not a confidential local path.
Codex CLI compatibility
Review the current Responses API protocol mismatch.