API reference
Privatemode supports API endpoints that are compatible with the OpenAI API and the Anthropic API. We like to highlight that we don't use any OpenAI or Anthropic services but only follow their interface definitions. Create and manage your API keys in the Privatemode portal.
Connect to Privatemode
Use the Privatemode SDK or proxy for client-verified end-to-end encryption. The proxyless API is a quickstart alternative with memory encryption and TLS termination inside a confidential computing environment, but no client-side attestation. It requires trusting Privatemode's zero data retention policy.
Proxyless API
Set your OpenAI-compatible client's base URL to https://proxyless-api.privatemode.ai/v1 and its API key to your Privatemode API key. For raw HTTP requests, include Authorization: Bearer <your-api-key> on every request.
See the proxyless API guide for request examples and the trust model.
SDK or proxy
Choose the setup for your application's language:
For JavaScript and TypeScript applications, we recommend the Privatemode SDK. It connects directly to Privatemode without a local proxy and handles remote attestation and end-to-end encryption in your application.
Install the SDK:
npm i privatemode-aiCreate a client with your Privatemode API key:
import { PrivatemodeAI } from 'privatemode-ai';
const client = new PrivatemodeAI({
apiKey: process.env.PRIVATEMODE_API_KEY!,
});The client exposes the familiar OpenAI interface. See the SDK getting started guide for a complete request, streaming, and the supported resources.
For other languages and third-party integrations, use the Privatemode proxy. It exposes a local OpenAI-compatible and Anthropic-compatible API while handling remote attestation and end-to-end encryption.
Base URL
With a proxy running on your machine, the base URL is:
http://localhost:8080All endpoints are served under the /v1 prefix.
For more information on how the proxy works, see the architecture documentation and the Privatemode proxy guide.
Authentication
The recommended way to authenticate is to configure the proxy with your API key via --api-key. The proxy then authenticates all requests for you, and the api_key field of client SDKs only needs a placeholder value.
Alternatively, start the proxy without an API key and pass your key with each request in the Authorization header. The proxy forwards the header to the Privatemode API:
Authorization: Bearer <your-api-key>Using the OpenAI SDKs
Since the API is OpenAI-compatible, you can use the official OpenAI SDKs by pointing them at your proxy:
from openai import OpenAI
client = OpenAI(
api_key="<your-api-key>", # or a placeholder if the proxy is configured with --api-key
base_url="http://localhost:8080/v1",
)import (
"github.com/openai/openai-go/v3"
"github.com/openai/openai-go/v3/option"
)
client := openai.NewClient(
// The API key only needs a placeholder if the proxy is configured with --api-key.
option.WithAPIKey("<your-api-key>"),
option.WithBaseURL("http://localhost:8080/v1"),
)Endpoints
OpenAI-compatible
- Chat completions:
POST /v1/chat/completions - Completions (legacy):
POST /v1/completions - Embeddings:
POST /v1/embeddings - Models:
GET /v1/models - Speech to text:
POST /v1/audio/transcriptions
Anthropic-compatible
- Messages:
POST /v1/messages
Unsupported endpoints
The OpenAI Responses API (POST /v1/responses) isn't currently supported.