Skip to main content

Overview

AI Sonar is native-first and OpenAI-compatible. Use provider-native routes such as POST /v1/messages for Anthropic and /v1beta/models/...:generateContent for Gemini when you need native behavior, and use OpenAI-compatible /v1 endpoints when you are migrating existing OpenAI-style SDKs or tools. POST /v1/responses remains an advanced optional path for Responses-specific behavior.

Base URL

Authentication

All API endpoints require authentication using a Bearer token:
Get your API key from the Dashboard.
About the Interactive Playground: The playground on this documentation site is for demonstration purposes only and does not support entering API keys. To test the API, please use:
  • cURL - Copy the example commands and replace sk-your-api-key with your actual key
  • Postman - Import our OpenAPI spec
  • SDK - Use OpenAI/Anthropic SDK with our base URL

Supported Endpoints

Chat & Text Generation

Embeddings & Rerank

Images

Some image models may return results inline, some may return task-based responses, and some may behave either way depending on the routed provider path. If the create response includes poll_url, follow it exactly.

Audio

Realtime

Use /v1/realtime for WebSocket upgrade requests. A plain GET /v1/realtime returns endpoint metadata for clients that cannot inspect WebSocket routes directly. It is not the OpenAI Realtime REST surface; client secret, translation client secret, Calls, and legacy beta session endpoints are not currently exposed.

Video

For new clients, prefer /v1/tasks/{id} and follow the poll_url returned by create responses. Keep /v1/videos/generations/{id} only for backward compatibility.

Async Tasks

This endpoint is not limited to video, music, and 3D. Some image tasks may also use /v1/tasks/{id} as the canonical polling path.

Music

For new clients, prefer the returned poll_url first. If you need a fixed task-status endpoint, use /v1/tasks/{id}; keep /v1/music/generations/{id} for music-specific compatibility paths.

3D Generation

For new clients, prefer the returned poll_url first. If you need a fixed task-status endpoint, use /v1/tasks/{id}; keep /v1/3d/generations/{id} for 3D-specific compatibility paths.

Models

Gemini (v1beta)

Native Google Gemini API format support:
Gemini endpoints support ?key= query parameter authentication in addition to standard Bearer token.

Response Format

All responses follow a consistent format:

Success Response

Error Response

Rate Limits

Rate limits are role-based and configurable by administrators. Default values:
Contact support for custom rate limits. Exact values may vary by account configuration.
When rate limits are exceeded, the API returns a 429 status code with a Retry-After header indicating how long to wait.

OpenAPI Specification

OpenAPI Spec

Download the complete OpenAPI 3.0 specification