Skip to main content
Phala Private AI is OpenAI-compatible. Most integrations require changing only the base URL and API key:
After migration, responses can be verified with x-receipt-id, Attestation Report, and Get Receipt.

Migrate from OpenAI

Everything else stays familiar: chat completions, streaming, tool calling, vision, structured output, and embeddings use OpenAI-compatible request shapes.

Migrate from OpenRouter

Model ids use the provider/model format returned by /v1/models. Verify the actual response receipt when you need evidence for an exchange.

OpenAI SDK

LangChain

Vercel AI SDK

Langfuse

Observability tools may store prompts, responses, metadata, or traces. For sensitive data, configure redaction or self-hosting before sending production traffic.
For custom Node.js or Bun applications, use the TypeScript ACI Verifier to inject a pinned fetch and audit signed receipts in code.

Gateways

Cloudflare AI Gateway

In Compute & AI → AI Gateway → Custom Providers → Add Custom Provider, set Provider Name to Phala, Provider Slug to phala, and Base URL to https://inference.phala.com, then save and enable the provider. Cloudflare’s custom-provider routing appends the path after custom-phala/, so the request includes /v1/chat/completions. For authenticated gateways, also send cf-aig-authorization:

LiteLLM

Add this model to your LiteLLM proxy config.yaml using its generic OpenAI-compatible route. Set PHALA_AI_API_KEY in the proxy’s environment and start it with litellm --config config.yaml:
Clients of the proxy use phala-glm as their model name; LiteLLM sends z-ai/glm-5.3 to Phala.

Migration Checklist

  • Create a Phala API key.
  • Change the base URL to https://inference.phala.com/v1.
  • List models with GET /v1/models.
  • Use a catalog model; every model on this endpoint runs in a TEE.
  • Capture x-receipt-id in raw HTTP responses when you need verification.
  • Verify one representative response before production rollout.

Use in Agents

On-demand API

Error Handling