CrewAI Integration with The Grid | Agent LLM Setup
Connect CrewAI to The Grid with the LLM class. Use the OpenAI-compatible endpoint, assign Grid models to agents, and tier by role.
Prerequisites
Setup
1. Add the key to your environment
THEGRID_API_KEY=your-consumption-key-here2. Build an LLM instance pointed at The Grid
LLM instance pointed at The Gridimport os
from crewai import LLM
grid_llm = LLM(
model="openai/agent-prime",
base_url="https://api.thegrid.ai/v1",
api_key=os.getenv("THEGRID_API_KEY"),
)3. Pass the LLM to your agents
4. (Optional) Tier instruments by agent role
5. Run the crew
Verification
Troubleshooting
Last updated
Was this helpful?