API Keys
All AI Sonar API requests require an API key. For OpenAI-compatible endpoints, send it as:/v1/messages requests, you can also use:
Getting Your API Key
- Log in to your AI Sonar Dashboard
- Open API Keys
- Create a new key
- Give it a descriptive name
- Copy it immediately because it is shown only once
Using API Keys
API Key Features
Usage Limits
You can set a usage limit on each API key:Key Prefix
All AI Sonar API keys start withsk-.
Anthropic Compatibility
For the/v1/messages endpoint, the Anthropic-style header works as expected:
Use
Authorization: Bearer ... for OpenAI-compatible endpoints such as /v1/responses, /v1/chat/completions, /v1/models, and most other AI Sonar routes.Error Responses
Example: