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 using pangea_enable_ai (or pangea ai enable), verify TLS against PANGEA_AI_CA_PEM, wire server-side calls to PANGEA_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:

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):

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

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).

Check five-meter billing status · Back to the app guide