PANGEA / SHARED AI
Add Gemma, Qwen & Speech AI to your app.
Self-service in every active workspace plan (Free Sandbox through Scale, Custom plans, and invited beta): activate Shared AI on any Dockerfile HTTP app without buying separate model API keys. Usage counts toward your workspace’s monthly AI & GPU Time (GPU-min) meter in Your apps → Usage.
Every enabled HTTP app can call Pangea’s internal Shared AI services—OpenAI-compatible LLM chat completions via model-family aliases (gemma and qwen) plus Speech synthesis and audio processing—over authenticated in-cluster TLS. This runtime API is separate from the coding AI you use to build and deploy.
1. Ask your coding AI (or enable in one click)
Enable Shared AI on this app usingpangea_enable_ai(orpangea ai enable), verify TLS againstPANGEA_AI_CA_PEM, wire server-side calls toPANGEA_LLM_BASE_URL/PANGEA_SPEECH_BASE_URL, and handle 429 or unavailable inference gracefully.
You or your agent can turn Shared AI on or off at any time—and rotate tokens independently—through three equivalent paths:
- MCP tool: call
pangea_enable_ai(orpangea_disable_ai) with yourproject_id. - CLI: run
pangea ai enable --project PROJECT_ID --apply(pass--rotateto issue a new token without rebuilding). - Web Console: open your app in Your apps and click Enable Shared AI in the Shared AI (LLM & Speech) panel.
2. Read the injected runtime environment
Once Shared AI is enabled (and applied on rollout/deploy), Pangea authorizes cluster network policy for your app and injects read-only runtime variables (those PANGEA_AI_*, PANGEA_LLM_*, and PANGEA_SPEECH_* prefixes are reserved and never overwritten by custom secrets):
PANGEA_AI_ENABLED=1PANGEA_LLM_BASE_URL(defaulthttps://llm-gateway.pangea-llm.svc.cluster.local:8443/v1)PANGEA_LLM_API_KEY(workspace-scoped ES256 tokenpga_ai_...)PANGEA_LLM_MODEL(default family aliasgemma;qwenanddefaultare also accepted)PANGEA_SPEECH_BASE_URL(defaulthttps://speech-router.pangea-speech.svc.cluster.local:8443)PANGEA_SPEECH_API_KEY(same signed Bearer tokenpga_ai_...)PANGEA_AI_CA_PEM(PEM CA bundle for verifying internal HTTPS endpoints—always load this CA cleanly; never disable TLS certificate verification)
Note: Earlier operator-enrolled apps that mount PANGEA_SERVICE_LLM_DIR remain supported seamlessly without breaking existing configurations.
3. Call Shared LLM & Speech from your server
Use PANGEA_LLM_API_KEY as a Bearer token against ${PANGEA_LLM_BASE_URL}/models or ${PANGEA_LLM_BASE_URL}/chat/completions. Model-family aliases (gemma default in PANGEA_LLM_MODEL, qwen, or default) route automatically to Pangea’s active Gemma 4 and Qwen 3 GPU pools without pinning your code to a host-specific weight:
{
"model": "gemma",
"messages": [
{
"role": "user",
"content": "Write a short greeting."
}
],
"max_tokens": 256
}Chat completions support stream: true SSE streaming and JSON-object mode. For Speech TTS, inspect GET ${PANGEA_SPEECH_BASE_URL}/v1/models or submit an idempotent job (use qwen3-tts-custom-voice for standard speakers, or qwen3-tts-base-voice-clone with reference WAV audio), poll GET /v1/jobs/{id} until state === "completed", download audio/wav from GET /v1/jobs/{id}/result, and release result storage via POST /v1/jobs/{id}/ack:
{
"kind": "tts",
"model": "qwen3-tts-custom-voice",
"input": {
"text": "Hello from Pangea.",
"language": "en",
"speaker": "Vivian"
}
}Include a unique Idempotency-Key header on POST /v1/jobs. Never expose keys in browser bundles, Git, build arguments, or logs.
Shared pool limits & reliability
- Workspace-shared request rate budget across all Shared AI apps in the workspace (default 6 starts per minute across LLM + Speech).
- 180-second deadline per LLM completion and up to 2,048 output tokens (within shared GPU input budgets).
- Shared GPUs run in Pangea’s Kyoto cluster; response latency depends on shared demand, and there is no silent fallback to third-party external model APIs.
Keep your app resilient
Handle HTTP 429 (with Retry-After backoff/jitter), 502/503/504, or timeouts without failing HTTP health/readiness probes or taking down unrelated routes. When an enforced plan reaches its monthly GPU-min cap, only Shared AI calls pause—your Web containers and /data stay online (legacy invited beta grants stay in Observation Phase without automatic cutoffs).