Use the Prem API SDK
1. Create an API key
- Open the dashboard. Sign in or register.
- Go to the API section.
- Create a new API key. Copy the key to a safe location.
PREM_API_KEY. Do not commit the API key to source control.
2. Install the SDK and make your first call
Install the TypeScript SDK from npm:The SDK runs natively on Node.js, Bun, Deno, and Bare. It needs no native add-ons. You use one client library across all of them, from a backend service to a mobile app. See the React Native guide.
CLIENT_KEK is your Key Encryption Key (KEK). The SDK expects a 32-byte key encoded as exactly 64 hexadecimal characters. The KEK protects your encryption keys and does not leave your device. See Encryption.
Get the latest endpoint values from
dashboard.prem.io/endpoints.json.3. Run a request
Run your script. The console shows the response.Use the OpenAI SDK
Run the bundled Confidential Proxy to expose OpenAI-compatible routes on your machine. Point thebaseURL of an OpenAI client at the Confidential Proxy.
PROXY_URL and ENCLAVE_URL from the environment. Pass the KEK with --kek; CLIENT_KEK is not currently bound as a CLI environment option.
Get the latest endpoint values from
dashboard.prem.io/endpoints.json./v1 URL. The client sends your API key as the bearer token with each request:
Verify the selected route
Model-list and completion responses expose the requested alias and, for OpenAI-format completions, the resolved model ID. They do not expose an assurance profile. Do not classify a route from its model name. Forglm-5.2, the completion response returns the resolved backend ID in response.model. See Platform Status for the current assurance boundary.
Next steps
API reference
Chat completions and other endpoints in detail.
Guides
Step-by-step guides for common flows (chat, audio, and more).
Models & Pricing
Available models, pricing tiers, and deployment strategies.
Agents & Automation
Building a bot, agent loop, or batch job? The config and gotchas that matter unattended.

