Skip to content
Rapid Router
← All integrations

RAG framework

How to use LlamaIndex with Rapid Router

LlamaIndex's OpenAILike class exists for exactly this: an OpenAI-shaped endpoint that serves models OpenAI does not. Set api_base and the model string.

Setup

  1. Install llama-index-llms-openai-like.
  2. Create the LLM as below and set it as Settings.llm.
  3. Build indexes and query engines as usual.
from llama_index.llms.openai_like import OpenAILike
from llama_index.core import Settings

Settings.llm = OpenAILike(
    model="anthropic/claude-sonnet-5",
    api_base="https://rapidrouter.ai/api/v1",
    api_key="<your Rapid Router key>",
    is_chat_model=True,
)

Field names as in LlamaIndex at the time of writing; their UI moves, the three values do not. LlamaIndex site.

Pick a model

The catalog lists every live model with its price per million tokens. For a coding tool, a strong model for edits and a cheap one for questions is the usual pair; the cost calculator shows what a month of your usage costs on each.

Common questions

Which model string do I put in LlamaIndex?

Any id from the catalog, in the vendor/model shape, for example anthropic/claude-sonnet-5. The models page lists every live id with its price; copy it exactly.

Does LlamaIndex need anything else to work with Rapid Router?

No. Rapid Router exposes the OpenAI chat completions API at https://rapidrouter.ai/api/v1, which is the shape LlamaIndex already sends. Streaming, tool calling and JSON mode work where the model supports them.

How is usage from LlamaIndex billed?

Per request at the provider's list price per million tokens, debited from your prepaid balance. Create a separate key for LlamaIndex and the dashboard shows its spend on its own; you can cap it monthly.

Is there a free allowance to test with?

Yes. Every account gets a daily allowance of free requests on eligible models before any top-up, so the first session costs nothing.

Get your API keyFree daily allowance, then top up by card in US dollars.