@premai/api-sdk.
It exposes OpenAI and Anthropic compatible HTTP routes on your machine.
If you use an OpenAI SDK or an OpenAI-compatible client, you do not need to change your application logic. Set the base URL to http://127.0.0.1:8000/v1. The same base URL applies to Anthropic clients.
How it works
The Confidential Proxy runs on your machine. It does the same client-side encryption as the SDK. The Confidential Proxy encrypts your plaintext before the data leaves your machine. The Prem API Gateway receives only ciphertext. The enclave decrypts the request inside its Trusted Execution Environment (TEE). See Encryption for the full cryptographic design: the XWing key exchange, the two-server model, and the threat model.Run the server
Run the Confidential Proxy directly withbunx or npx. No installation is necessary. As an alternative, install it globally:
ghcr.io/premai-io/confidential-proxy:latest:
HOST=0.0.0.0 and PORT=8787. You can override these values with environment variables or CLI flags. Use CLI flags for --compat and --tls. You cannot set these two flags with environment variables.
By default, the server listens on http://127.0.0.1:8000.
Set
PROXY_URL and ENCLAVE_URL to the values for your environment. Get the latest values from dashboard.prem.io/endpoints.json.Configuration
Configure the Confidential Proxy with environment variables or CLI flags. Flags have precedence.Environment variables
CLI options
All commands accept the same server options:Compatibility modes
Use--compat to select the API surface:
both mode, the Confidential Proxy serves the two APIs under separate prefixes. This prevents route conflicts. Set the base URL to http://127.0.0.1:8000/openai/v1 for OpenAI clients. Set it to http://127.0.0.1:8000/anthropic/v1 for Anthropic clients. The Anthropic surface translates each Anthropic Messages request into the internal OpenAI-compatible enclave pipeline. It then returns the response as Anthropic SSE events.
Connect a client
OpenAI
Set the base URL tohttp://127.0.0.1:8000/v1. If you use --compat both, set it to http://127.0.0.1:8000/openai/v1. Send your API key as a bearer token:
Anthropic
Set the base URL tohttp://127.0.0.1:8000/v1. If you use --compat both, set it to http://127.0.0.1:8000/anthropic/v1. Authenticate with x-api-key. Send the anthropic-version header:
"stream": true for incremental responses:
temperature, and top_p. Streaming responses follow the Anthropic SSE format (message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop).
Hermes Agent
You can use the Confidential Proxy as a custom provider in Hermes. Start the proxy inopenai mode:
~/.hermes/config.yaml:
localhost:8000.
Claude for Microsoft 365
The Confidential Proxy can be the gateway for the Claude for Microsoft 365 add-in. The add-in uses HTTPS and CORS. Start the proxy with these flags:The add-in cannot connect to
127.0.0.1 on macOS. macOS prevents cross-origin browser requests to loopback addresses. Run the proxy on a different machine on your network, or use a container with its own network interface. Point the add-in at that hostname.Run the proxy as a daemon
By default, the Confidential Proxy runs in the foreground. The CLI can also manage it as a background daemon.1
start
The
start command does these steps:- It checks for a daemon that is in operation. It does not start a second daemon.
- It spawns itself as a child process. It sends the logs to the log file that you configure.
- It polls the HTTP endpoint until the server is reachable.
- It then exits and the daemon continues to run.
2
stop
The
stop command stops the daemon. It waits a maximum of 5 seconds. If the daemon does not stop, the command stops it immediately.3
status
The
status command checks if the process is alive and if the HTTP endpoint is reachable.start, stop, status):
Next steps
Quickstart
The step-by-step guide to get your first request working.
Developer Experience
The two ways to integrate: the TypeScript SDK and the Confidential Proxy.
Chat completions
The chat API in detail, with streaming and vision payloads.
Encryption
The key exchange and the end-to-end encryption in detail.
The same proxy operates
confidential-claude, an integration that comes with the SDK.
This integration starts Claude Code connected to the encrypted gateway.
All traffic uses the Confidential Proxy.
