Skip to main content

API Overview

PolarGrid provides an OpenAI-compatible REST API, making it easy to migrate existing applications or use familiar patterns.

Base URL

All inference traffic targets a regional edge gateway directly:
Available regions (16):
  • yto-01 — Toronto
  • yul-01 — Montreal
  • yul-02 — Montreal 02
  • yvr-02 — Vancouver
  • nyc-01 — New York
  • nyc-02 — New York 02
  • dfw-01 — Dallas
  • dfw-02 — Dallas 02
  • sfo-01 — San Francisco
  • lax-01 — Los Angeles
  • sea-01 — Seattle
  • chi-01 — Chicago
  • phx-01 — Phoenix
  • was-01 — Washington DC
  • mia-01 — Miami
  • sfo-03 — San Francisco

Picking a region

There are two patterns:
  1. Auto-route via the autorouter (recommended). Make a single GET https://autorouter.polargrid.ai/v1/route to discover the best edge for the caller — the nearest edge in the caller’s country (falling back to the globally nearest edge if none is available) — then use the returned endpoint as the base URL for all subsequent requests. This is what the SDKs do internally — see Regions.
  2. Pin a specific region. Skip the autorouter and hit https://api.{region}.edge.polargrid.ai directly when you need predictable routing.
autorouter.polargrid.ai is a discovery service, not an inference proxy. It serves GET /v1/route only. Sending POST /v1/chat/completions (or any other inference verb) to the autorouter returns 403 — CloudFront on that distribution only allows cacheable requests.

Authentication

Edge endpoints accept your pg_* API key directly — attach it as a bearer token on every request. See Authentication for full details.
Get your API key from the Console.

Endpoints

Text Inference

Audio

Models

Operator endpoints (superadmin only)

The model-lifecycle and GPU endpoints below act on node-global, multi-tenant state. They require a superadmin-scoped credential issued only to PolarGrid operators — standard pg_* API keys receive 403 Forbidden. You never need these for inference; models are pre-deployed per region (see Model Loading and GPU).

Health

Request Format

Most POST requests accept JSON. The exception is speech-to-text (POST /v1/audio/transcriptions), which takes a multipart/form-data file upload with its options as query parameters — see Speech to Text.

Response Format

Responses are JSON with this structure:

Errors

Errors return appropriate HTTP status codes with a detail string (FastAPI format):

Streaming

For streaming responses, set stream: true:
Streaming responses use Server-Sent Events (SSE). See the Streaming Guide for details.

OpenAI Compatibility

PolarGrid’s REST API follows OpenAI’s endpoint structure and request/response formats, so tools that speak the OpenAI wire protocol (e.g., curl, LangChain, LiteLLM) can target PolarGrid with a base URL change. The PolarGrid Python and JavaScript SDKs use their own method signatures (e.g., client.chat_completion({...}) instead of client.chat.completions.create(...)) and are not drop-in replacements for the OpenAI SDK. See the SDK docs for details. Known limitations vs. OpenAI: