Skip to main content
LlamaIndex provides a framework for building LLM applications with your data. Add the AI Gateway to get production-grade features: full observability, automatic fallbacks, semantic caching, and cost controls—all without changing your LlamaIndex code.

Quick Start

Add the AI Gateway to any LlamaIndex app with 3 parameters:
That’s it! You now get:
  • ✅ Full observability (costs, latency, logs)
  • ✅ Dynamic model selection per request
  • ✅ Automatic fallbacks and retries (via configs)
  • ✅ Budget controls per team/project

Why Add the AI Gateway to LlamaIndex?

LlamaIndex handles data indexing and querying. The AI Gateway adds production features:

Enterprise Observability

Every request logged with costs, latency, tokens. Team-level analytics and debugging.

Dynamic Model Selection

Switch models per request. Route simple queries to cheap models, complex to advanced—automatically tracked.

Production Reliability

Automatic fallbacks, smart retries, load balancing—configured once, works everywhere.

Cost & Access Control

Budget limits per team/project. Rate limiting. Centralized credential management.

Setup

1. Install Packages

2. Add Provider in Model Catalog

  1. Go to Model Catalog → Add Provider
  2. Select your provider (OpenAI, Anthropic, Google, etc.)
  3. Choose existing credentials or create new by entering your API keys
  4. Name your provider (e.g., openai-prod)
Your provider slug will be @openai-prod (or whatever you named it).

Complete Model Catalog Guide →

Set up budgets, rate limits, and manage credentials

3. Get AI Gateway API Key

Create your AI Gateway API key at stratacloudmanager.paloaltonetworks.com

4. Use in Your Code

Replace your existing LLM initialization:
That’s the only change needed! All your existing LlamaIndex code (indexes, query engines, agents) works exactly the same.

Switching Between Providers

Just change the model string—everything else stays the same:
The AI Gateway implements OpenAI-compatible APIs for all providers, so you always use llama_index.llms.openai.OpenAI regardless of which model you’re calling.

Using with LlamaIndex Chat

LlamaIndex’s chat interface works seamlessly:

Works With All LlamaIndex Features

Query Engines - All query types supported ✅ Chat Engines - Conversational interfaces ✅ Agents - Full agent compatibility ✅ Streaming - Token-by-token streaming ✅ RAG Pipelines - Retrieval-augmented generation ✅ Workflows - Complex LLM workflows

Streaming

Async Support

RAG with Query Engine

Advanced Features via Configs

For production features like fallbacks, caching, and load balancing, use AI Gateway Configs:

Example: Fallbacks

Example: Load Balancing

Example: Caching

Learn About Configs →

Set up fallbacks, retries, caching, load balancing, and more

Observability

The AI Gateway automatically logs all requests. Add custom metadata for better analytics: Filter and analyze logs by metadata in Strata Cloud Manager.

Observability Guide →

Track costs, performance, and debug issues

Prompt Management

Use prompts from the AI Gateway’s Prompt Library:

Migration from Direct OpenAI

Already using LlamaIndex with OpenAI? Just update 3 parameters:
Benefits:
  • Zero code changes to your existing LlamaIndex logic
  • Instant observability for all requests
  • Production-grade reliability features
  • Cost controls and budgets

Next Steps

Model Catalog

Set up providers, budgets, and access control

Configs

Configure fallbacks, caching, and routing

Observability

Track costs, performance, and usage

Guardrails

Add PII detection and content filtering
Last modified on September 15, 2026