generateContent.
Prerequisites
- Python 3.10–3.13
uv- A CometAPI account with an active API key — get yours in the dashboard
- Four text model IDs for the transports shown below
Configure the integration
1
Create a project and install CrewAI
Create a new
uv project and install CrewAI with its Anthropic and Google Gen AI extras:2
Set your API key and model IDs
Set the CometAPI API key and one model ID for each transport:Replace every
your-model-id value with a model ID from the CometAPI Models page. The four values can be different. Assign each model ID to its corresponding transport.3
Create the sequential Crew
Save the following example as The Agents have no tools, cannot delegate, and run one at a time. Every Task after the first declares its preceding Tasks in
crew.py:context, so CrewAI includes those prior outputs in the next Task.4
Run the Crew
Run the example in the same shell session:The script prints all four Task outputs, including the final release brief.
Route mapping
The two OpenAI configurations above need the
/v1 suffix in base_url. The Anthropic and Gemini configurations add their own versioned route, so their base URL is the CometAPI origin without /v1.
Choose model IDs
Use the CometAPI Models page to choose one text model ID for each transport. Store the model IDs in environment variables so you can change them without editing the Python file. Do not add a provider prefix to an environment variable. The example addsanthropic/ and gemini/ where CrewAI uses those prefixes for provider selection.
Troubleshooting
Anthropic or Gemini provider imports fail
Anthropic or Gemini provider imports fail
Run
uv add 'crewai[anthropic,google-genai]' in the project. The base CrewAI package does not install both optional provider SDKs by default.A Responses request returns a parameter error
A Responses request returns a parameter error
Remove optional parameters that are not part of the selected model’s interface. The example configures only the output token limit for Responses.
A request uses the wrong route
A request uses the wrong route
Compare the
LLM configuration with the route mapping table. In particular, use custom_openai=True with the correct api value, and keep the Gemini base URL inside client_params.http_options.