Back to models
Try in Agents
Model · Perplexity
Sonar
perplexity/sonar
Perplexity's search model
Specs
Context
127K
Max output
8K
Provider
Perplexity
Input
$0.250/ 1M tokens
Output
$2.50/ 1M tokens
Cache read
—
Try it
Chat with SonarTerramind API
⌘+Enter to run
Code
import { streamText } from "ai";
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
const terramind = createOpenAICompatible({
name: "terramind",
baseURL: "https://terramind.com/api/v1",
apiKey: process.env.TERRAMIND_API_KEY!,
});
const result = streamText({
model: terramind("sonar"),
prompt: "Why is the sky blue?",
});
for await (const chunk of result.textStream) {
process.stdout.write(chunk);
}
Want to run this in your app? Grab an API key · Full chat reference