api_base to the gateway URL, all LlamaIndex LLM calls route through Portkey.
Installation
1
Start the gateway
- Local (npx)
- Portkey Cloud
http://localhost:8787/v1.2
Install dependencies
Basic setup
Setapi_base on the OpenAI LLM class to point at the gateway.
Adding routing configs via headers
Pass gateway configs throughdefault_headers to enable retries, caching, fallbacks, and other features.
Using in a query engine
Once the LLM is configured, pass it toSettings and build any LlamaIndex index or query engine as normal.