To use Studio through LlamaIndex, here are the follow:

  1. Install dependencies
pip install llama-index
pip install llama-index-llms-openrouter
  1. Export studio key as OpenRouter key
export OPENROUTER_API_KEY="<Tune Studio API Key>"
  1. Init llm using OpenRouter
from llama_index.llms.openrouter import OpenRouter

llm = OpenRouter(
    api_base="<https://proxy.tune.app>",
    max_tokens=256,
    model="MODEL_ID",
)

response = llm.complete("Paul Graham is")
print(response)

Follow along with the LlamaIndex tutorial here