Skip to main content
Prem API is an end-to-end encrypted, OpenAI-compatible API. It gives chat, audio, and model endpoints with the same request shapes as OpenAI. Use the TypeScript SDK, or run the bundled Confidential Proxy and connect with an OpenAI client. You can start with a few lines of code.
If you use an AI coding agent, load Prem API into the context of your agent with one command. See Use LLMs.

Use the Prem API SDK

1. Create an API key

  1. Open the dashboard. Sign in or register.
  2. Go to the API section.
  3. Create a new API key. Copy the key to a safe location.
Store the API key in an environment variable, for example 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:
Then use this code to initialize the client and call the API:
You must set all four environment variables. CLIENT_KEK is your Key Encryption Key (KEK). The KEK is a 32-byte base64 secret that you generate and keep. The KEK protects your encryption keys and does not leave your device. See Encryption. Add the variables to your .env file:
Get the latest endpoint values from dashboard.prem.io/endpoints.json.

3. Run a request

Run your script. The console shows the response.
For error codes and HTTP conventions, see Errors. For request limits, see Rate limits.

Use the OpenAI SDK

Run the bundled Confidential Proxy to expose OpenAI-compatible routes on your machine. Point the baseURL of an OpenAI client at the Confidential Proxy. You do not change the SDK.
Configure the Confidential Proxy with these environment variables. Add them to your .env file:
Get the latest endpoint values from dashboard.prem.io/endpoints.json.
When the Confidential Proxy runs, install the OpenAI JavaScript SDK. Point the SDK at your local /v1 URL. The client sends your API key as the bearer token with each request:
See Confidential Proxy for all proxy options: Anthropic compatibility, daemon mode, and the full configuration.

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.