Developer Documentation & SDKs
Phantom is a 1-line drop-in replacement for OpenAI endpoints. Point your OpenAI SDK or agent runtime to https://phantom.codes/v1 to route traffic through hardware-attested Intel TDX enclaves with zero prompt logs.
1-Line Drop-In SDKs
Choose your framework below. All standard OpenAI clients, Vercel AI SDK, LangChain, and IDEs work out of the box.
from openai import OpenAI
# 1. Point standard OpenAI SDK to Phantom's confidential TEE gateway
client = OpenAI(
base_url="https://phantom.codes/v1",
api_key="sk-phantom-your-api-key"
)
# 2. Stream tokens with 0% deposit markup and hardware isolation
response = client.chat.completions.create(
model="deepseek/deepseek-v3.2",
messages=[
{"role": "user", "content": "Explain Intel TDX hardware enclaves."}
],
stream=True
)
for chunk in response:
print(chunk.choices[0].delta.content or "", end="")Authentication
All endpoints under /v1/* require a Bearer token in the standard HTTP Authorization header.
Authorization: Bearer sk-phantom-1234567890abcdef...Endpoints Reference
/v1/chat/completionsInitiate OpenAI-compatible LLM token completions. Automatically detects and applies prompt cache hit discounts.
curl https://phantom.codes/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-phantom-your-key-here" \
-d '{
"model": "deepseek/deepseek-v3.2",
"messages": [{"role": "user", "content": "What are TEE registers?"}],
"stream": false
}'/v1/key/balanceFetch your real-time balance in USD and micro-USD, total spent, and expiry timestamp.
curl https://phantom.codes/v1/key/balance \ -H "Authorization: Bearer sk-phantom-your-key-here"
/v1/key/rotateAtomically deactivates your current API key and issues a replacement key inheriting 100% of your remaining balance and expiry.
curl -X POST https://phantom.codes/v1/key/rotate \ -H "Authorization: Bearer sk-phantom-your-key-here"
/api/v1/attestRetrieve real-time Intel TDX Quote v4 registers (RTMR0-3), Hugging Face weight commit hashes, and Merkle root checksums.
curl -s "https://phantom.codes/api/v1/attest?model=deepseek/deepseek-v3.2" | jq .
/api/v1/account/grantClaim $1.00 (1,000,000 micro-USD) of verified compute credits by authenticating with GitHub or Google on /account. If referred by another developer, you receive $1.50 and the referrer receives $1.00 credited automatically.
curl -X POST "https://phantom.codes/api/v1/account/grant" \
-H "Content-Type: application/json" \
-H "Cookie: better-auth.session_token=YOUR_SESSION_COOKIE" \
-d '{
"referrer_id": "optional_referrer_user_id"
}'Cryptographic Response Headers
Every HTTP response carries the enclave receipt identifiers issued by the upstream TEE gateway, forwarded verbatim:
IDE & Coding Agent Setup
Route your coding agent queries through hardware-attested enclaves with zero prompt snooping:
Cursor Setup
Navigate to Cursor Settings → Models → OpenAI API Key:
Claude Code / Cline / Aider Setup
Set environment variables in your terminal: