---
title: Perplexity: Sonar API | Text Generation | ModelsLab
description: Build with Perplexity: Sonar API by Perplexity. Text generation, chat, code, and reasoning. Pay-per-use. Free tier.
url: https://modelslab.com/models/perplexity/perplexity-sonar/api.md
canonical: https://modelslab.com/models/perplexity/perplexity-sonar/api.md
type: product
component: Playground/LLM/Index
generated_at: 2026-04-15T02:01:31.184000Z
---

Perplexity: Sonar
---

 [LLMs.txt](https://modelslab.com/models/open_router/perplexity-sonar/llms.txt) [.md](https://modelslab.com/models/perplexity/perplexity-sonar.md)

perplexity-sonar perplexity Closed Source Model $1.000000 / call

Perplexity: Sonar
---

Choose a prompt below to get started or type your own message

 Explain quantum computing in simple terms

 Write a Python function to sort a list

 Create a marketing email for a SaaS product

 Compare REST vs GraphQL APIs

Send

### Perplexity: Sonar

perplexity perplexity-sonar

Copy model ID

PricingInput $1.00 / 1M tokens

Output $1.00 / 1M tokens

API EndpointsOpenAI Compatible

`https://modelslab.com/api/v7/llm/chat/completions`Endpoint

Anthropic Compatible

`https://modelslab.com/api/v7/llm/v1/messages`Messages

`https://modelslab.com/api/v7/llm/v1/messages/count_tokens`Count Tokens

`https://modelslab.com/api/v7/llm/v1/models`Models

Use with Claude Code

cURL Example

ParametersSystem MessageYou are a helpful AI assistant specialized in providing accurate and detailed responses.

Temperature0.7

Max Tokens1000

Top P0.9

Frequency Penalty0

Presence Penalty0

Model Info

Support

Related Models
---

Discover similar models you might be interested in

 [View all LLM Models](https://modelslab.com/models?feature=llmaster)

[Q3](https://modelslab.com/models/together_ai/Qwen-Qwen2.5-32B)[Together AI](https://modelslab.com/models/together_ai)

 [Qwen2.5 32B

Closed Source Model](https://modelslab.com/models/together_ai/Qwen-Qwen2.5-32B)

[Q0](https://modelslab.com/models/together_ai/Qwen-Qwen3-0.6B-Base)[Together AI](https://modelslab.com/models/together_ai)

 [Qwen3 0.6B Base

Closed Source Model](https://modelslab.com/models/together_ai/Qwen-Qwen3-0.6B-Base)

[![Gemini 2.5 Flash](https://images.stablediffusionapi.com/?Image=https://assets.modelslab.ai/generations/4fc6b09e-c7ae-4301-aed1-0b180b88157b.png)](https://modelslab.com/models/google/gemini-2.5-flash)[Google](https://modelslab.com/models/google)

 [Gemini 2.5 Flash

Closed Source Model](https://modelslab.com/models/google/gemini-2.5-flash)

[KK](https://modelslab.com/models/together_ai/moonshotai-Kimi-K2.5)[Together AI](https://modelslab.com/models/together_ai)

 [Kimi K2.5

Closed Source Model](https://modelslab.com/models/together_ai/moonshotai-Kimi-K2.5)

[ZG](https://modelslab.com/models/open_router/z-ai-glm-5-turbo)[Open Router](https://modelslab.com/models/open_router)

 [Z.ai: GLM 5 Turbo

Closed Source Model](https://modelslab.com/models/open_router/z-ai-glm-5-turbo)

[Q9](https://modelslab.com/models/together_ai/Qwen-Qwen3.5-9B-FP8)[Together AI](https://modelslab.com/models/together_ai)

 [Qwen3.5 9B Fp8

Closed Source Model](https://modelslab.com/models/together_ai/Qwen-Qwen3.5-9B-FP8)

[MM](https://modelslab.com/models/open_router/morph-morph-v3-large)[Open Router](https://modelslab.com/models/open_router)

 [Morph: Morph V3 Large

Closed Source Model](https://modelslab.com/models/open_router/morph-morph-v3-large)

[ZG](https://modelslab.com/models/open_router/z-ai-glm-4.7-flash)[Open Router](https://modelslab.com/models/open_router)

 [Z.ai: GLM 4.7 Flash

Closed Source Model](https://modelslab.com/models/open_router/z-ai-glm-4.7-flash)

[![GPT 5.1](https://images.stablediffusionapi.com/?Image=https://assets.modelslab.ai/generations/fad83520-47a8-4059-b4b9-b32adf4d0be7.png)](https://modelslab.com/models/openai/gpt5.1)[Open Ai](https://modelslab.com/models/openai)

 [GPT 5.1

Closed Source Model](https://modelslab.com/models/openai/gpt5.1)

[OO](https://modelslab.com/models/open_router/openai-o4-mini)[Open Router](https://modelslab.com/models/open_router)

 [OpenAI: o4 Mini

Closed Source Model](https://modelslab.com/models/open_router/openai-o4-mini)

[G5](https://modelslab.com/models/together_ai/zai-org-GLM-5.1)[Together AI](https://modelslab.com/models/together_ai)

 [GLM 5.1 FP4

Closed Source Model](https://modelslab.com/models/together_ai/zai-org-GLM-5.1)

[M3](https://modelslab.com/models/together_ai/mistralai-Ministral-3-14B-Instruct-2512)[Together AI](https://modelslab.com/models/together_ai)

 [Ministral 3 14B Instruct 2512

Closed Source Model](https://modelslab.com/models/together_ai/mistralai-Ministral-3-14B-Instruct-2512)

[CV](https://modelslab.com/models/together_ai/deepcogito-cogito-v1-preview-qwen-14B)[Together AI](https://modelslab.com/models/together_ai)

 [Cogito V1 Preview Qwen 14B

Closed Source Model](https://modelslab.com/models/together_ai/deepcogito-cogito-v1-preview-qwen-14B)

[AJ](https://modelslab.com/models/open_router/ai21-jamba-large-1.7)[Open Router](https://modelslab.com/models/open_router)

 [AI21: Jamba Large 1.7

Closed Source Model](https://modelslab.com/models/open_router/ai21-jamba-large-1.7)

[N3](https://modelslab.com/models/together_ai/nim-meta-llama-3.2-90b-vision-instruct)[Together AI](https://modelslab.com/models/together_ai)

 [nim/meta/llama-3.2-90b-vision-instruct

Closed Source Model](https://modelslab.com/models/together_ai/nim-meta-llama-3.2-90b-vision-instruct)

[II](https://modelslab.com/models/open_router/inflection-inflection-3-productivity)[Open Router](https://modelslab.com/models/open_router)

 [Inflection: Inflection 3 Productivity

Closed Source Model](https://modelslab.com/models/open_router/inflection-inflection-3-productivity)

[AN](https://modelslab.com/models/open_router/amazon-nova-micro-v1)[Open Router](https://modelslab.com/models/open_router)

 [Amazon: Nova Micro 1.0

Closed Source Model](https://modelslab.com/models/open_router/amazon-nova-micro-v1)

[Q2](https://modelslab.com/models/together_ai/Qwen-Qwen3-235B-A22B-fp8)[Together AI](https://modelslab.com/models/together_ai)

 [Qwen3 235B A22B FP8

Closed Source Model](https://modelslab.com/models/together_ai/Qwen-Qwen3-235B-A22B-fp8)

About Perplexity: Sonar
---

Sonar is lightweight, affordable, fast, and simple to use — now featuring citations and the ability to customize sources. It is designed for companies seeking to integrate lightweight question-and-answer features...

### Technical Specifications

Model IDperplexity-sonarCategoryLLM ModelsTaskText GenerationPrice$1.000000 per million tokensAddedFebruary 20, 2026

### Key Features

- Chat completion and multi-turn conversation API
- Streaming response with token-by-token output
- Function calling and tool use support
- System prompts and role-based messaging
- JSON mode and structured output

### Quick Start

Integrate Perplexity: Sonar into your application with a single API call. Get your API key from the [pricing page](https://modelslab.com/pricing) to get started.

PythonJavaScriptcURLPHP

```
<code>import requests
import json

url = "https://modelslab.com/api/v7/llm/chat/completions"

headers = {
    "Content-Type": "application/json"
}

data = {
        "model_id": "perplexity-sonar",
        "messages": [
            {
                "role": "user",
                "content": "Hello!"
            }
        ],
        "max_tokens": 1000,
        "key": "YOUR_API_KEY"
    }

try:
    response = requests.post(url, headers=headers, json=data)
    response.raise_for_status()  # Raises an HTTPError for bad responses (4XX or 5XX)
    result = response.json()
    print("API Response:")
    print(json.dumps(result, indent=2))
except requests.exceptions.HTTPError as http_err:
    print(f"HTTP error occurred: {http_err} - {response.text}")
except Exception as err:
    print(f"Other error occurred: {err}")</code>
```

View the [full API documentation](https://modelslab.com/models/perplexity/perplexity-sonar/api) for SDKs, code examples in Python, JavaScript, and more.

### Pricing

Perplexity: Sonar API costs $1.000000 per million tokens. Pay only for what you use with no minimum commitments. [View pricing plans](https://modelslab.com/pricing)

### Use Cases

- AI chatbots and virtual assistants
- Code generation and developer tools
- Content writing and copywriting automation
- Data analysis, summarization, and extraction

[Browse LLM Models](https://modelslab.com/models?feature=llmaster) [More from Perplexity](https://modelslab.com/models/open_router) [View Pricing](https://modelslab.com/pricing)

Perplexity: Sonar FAQ
---

### What is Perplexity: Sonar?

Sonar is lightweight, affordable, fast, and simple to use — now featuring citations and the ability to customize sources. It is designed for companies seeking to integrate lightweight question-and-answer features...

### How do I use the Perplexity: Sonar API?

You can integrate Perplexity: Sonar into your application with a single API call. Sign up on ModelsLab to get your API key, then use the model ID "perplexity-sonar" in your API requests. We provide SDKs for Python, JavaScript, and cURL examples in the API documentation.

### How much does Perplexity: Sonar cost?

Perplexity: Sonar costs $1.000000 per million tokens. ModelsLab uses pay-per-use pricing with no minimum commitments. A free tier is available to get started.

### What is the Perplexity: Sonar model ID?

The model ID for Perplexity: Sonar is "perplexity-sonar". Use this ID in your API requests to specify this model.

### Does Perplexity: Sonar have a free tier?

Yes, ModelsLab offers a free tier that lets you try Perplexity: Sonar and other AI models. Sign up to get free API credits and start building immediately.

---

*This markdown version is optimized for AI agents and LLMs.*

**Links:**
- [Website](https://modelslab.com)
- [API Documentation](https://docs.modelslab.com)
- [Blog](https://modelslab.com/blog)

---
*Generated by ModelsLab - 2026-04-15*