Skip to main content

Overview

Type: Framework or PlatformPrimary Path: OpenAI-compatible via OpenAILikeSupport Confidence: Supported via OpenAILike
For AI Sonar, the more robust LlamaIndex setup is to use OpenAI-compatible integrations instead of the built-in OpenAI classes. Current LlamaIndex docs explicitly recommend OpenAILike for third-party OpenAI-compatible endpoints, because the built-in OpenAI classes infer metadata from official model names. In other words: treat OpenAILike as the supported AI Sonar path here, not the built-in OpenAI classes.

Installation

Basic Configuration

Basic Usage

Minimal OpenAILike LLM

Chat

Streaming

Embeddings

RAG with Documents

Chat Engine

Async Usage

Best Practices

Prefer llama_index.llms.openai_like.OpenAILike and llama_index.embeddings.openai_like.OpenAILikeEmbedding for AI Sonar and other third-party OpenAI-compatible gateways.
Pass api_base="https://api.aisonar.dev/v1" directly in code instead of relying on older OpenAI environment-variable names.
Use chat/reasoning models for synthesis and text-embedding-3-small or text-embedding-3-large for retrieval.