Skip to main content

Migrating from OpenAI

PolarGrid exposes an OpenAI-compatible API. If you’re already using OpenAI, migration is straightforward — in many cases it’s a single line change.

Option 1: Use the OpenAI SDK directly

The fastest migration path. Keep using the OpenAI SDK — just change the base URL and auth.
The edge accepts your pg_* API key directly — no token exchange step.

Option 2: Use the PolarGrid SDK

The PolarGrid SDK handles authentication, region selection, and token refresh automatically.
What the SDK handles for you:
  • Latency-based region selection (pings all regions, picks the fastest)
  • Direct API key auth — your pg_* is the bearer token, no extra exchange step
  • Streaming, audio, and model management APIs

Option 3: Direct HTTP

If you’re calling OpenAI via raw HTTP, swap the base URL:

What’s Different

The PolarGrid SDK eliminates most of these differences — it handles auth, region selection, and token refresh automatically. If you’re building a new integration, start with the SDK.

Speech-to-Text: Sync vs Async

OpenAI’s transcription endpoint is strictly synchronous. PolarGrid’s /v1/audio/transcriptions defaults to an async job202 Accepted with { job_id, status, poll_url } — which is better for long files but surprises OpenAI migrators expecting a transcript in the response body. What you’ll get depends on how you call it:
  • Stock OpenAI SDK (Option 1 above): no change needed. OpenAI SDKs send model as a multipart form field, and the endpoint serves those requests synchronously — you get the transcript inline, exactly as you do against OpenAI.
  • Raw HTTP or query-parameter requests: add ?sync=true to block until completion and get the formatted result inline. Without it you’ll receive a JSON job object, not your transcript.
There’s also ?stream=true for live partial transcripts over SSE (mutually exclusive with sync=true). Full details in the Speech-to-Text API reference.

Next Steps

Models

See all available models and specs

Regions

Understand edge regions and auto-routing

Streaming

Stream responses as they’re generated

Voice AI

Text-to-speech and speech-to-text