AI Gateway
Overview
CrewAI is a framework for orchestrating multi-agent teams with role-based agents, hierarchical task management, and collaborative AI workflows. Connecting CrewAI to Orq.ai’s AI Gateway provides access to 300+ models with a single configuration change.Key Benefits
Orq.ai’s AI Gateway enhances CrewAI applications with:Complete Observability
Track every agent task, tool use, and crew interaction with detailed traces
Built-in Reliability
Automatic fallbacks, retries, and load balancing for production resilience
Cost Optimization
Real-time cost tracking and spend management across all AI operations
Multi-Provider Access
Access 300+ LLMs and 20+ providers through a single, unified integration
Prerequisites
Before integrating CrewAI with Orq.ai, ensure the following are in place:- An Orq.ai account and API Key
- Python 3.10 or higher
To set up an API key, see API keys & Endpoints.
Installation
Configuration
Configure CrewAI to use Orq.ai’s AI Gateway via theLLM class with a custom base_url:
Python
base_url: https://api.orq.ai/v3/router
Basic Agent Example
Python
Multi-Agent Crew
Orchestrate multiple agents with specialized roles:Python
Model Selection
With Orq.ai, any supported model from 20+ providers can be used:Always prefix model IDs with
openai/ when using CrewAI with the AI Gateway. Without it, CrewAI may route the request through a matching native provider client (notably its built-in Google client) that ignores base_url, producing misleading errors like “API key not valid”. The openai/ prefix forces the OpenAI-compatible code path, which respects base_url for every provider.Python