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.
Base URL
The Privatemode API is accessed through the Privatemode proxy. The proxy serves as your API endpoint and handles end-to-end encryption and remote attestation for you. 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 proxy configuration guide.
Authentication
The recommended way to authenticate is to configure the proxy with your API key via --apiKey. 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 --apiKey
base_url="http://localhost:8080/v1",
)import OpenAI from 'openai';
const client = new OpenAI({
apiKey: '<your-api-key>', // or a placeholder if the proxy is configured with --apiKey
baseURL: '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 --apiKey.
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