LiteLLM Integration with The Grid | SDK and Proxy Setup
Use LiteLLM with The Grid as an OpenAI-compatible backend. Connect through the Python SDK or proxy and route downstream tools.
Two patterns
Prerequisites
Pattern 1: LiteLLM SDK
import os
import litellm
response = litellm.completion(
model="openai/agent-prime",
api_base="https://api.thegrid.ai/v1",
api_key=os.environ["THEGRID_API_KEY"],
messages=[{"role": "user", "content": "Plan a three-step research task."}],
)
print(response.choices[0].message.content)Pattern 2: LiteLLM Proxy
1. Install and set keys
2. Write config.yaml
config.yaml3. Start the proxy
4. Verify with curl
Point downstream tools at the proxy
Stable aliases for multi-provider setups
Troubleshooting
Last updated
Was this helpful?