Skip to main content
Agno lets you build and run AI agents in Python. Agno includes an official CometAPI model provider, so you can use CometAPI directly from agno.models.cometapi without creating a custom adapter.

Prerequisites

Configure the integration

1

Install Agno

Install Agno in your Python environment:
2

Set your CometAPI API key

Store your CometAPI API key in the COMETAPI_KEY environment variable:
3

Create an Agno agent

Use Agno’s official CometAPI provider:
Replace your-model-id with a current model ID from the CometAPI Models page.
4

Run the agent

Save the example as agent.py, then run it from the same shell session:
A successful response confirms that Agno is sending model calls through CometAPI.

How Agno connects to CometAPI

Agno’s official CometAPI provider reads COMETAPI_KEY from your environment and uses https://api.cometapi.com/v1 as the default base URL. It extends Agno’s OpenAI-compatible model interface internally, but your application code should import and instantiate CometAPI. You can also pass the API key or base URL explicitly when your runtime cannot read environment variables:

List available models

Agno’s provider exposes get_available_models() for checking the model IDs available through your CometAPI account:

Troubleshooting

Confirm that COMETAPI_KEY is set in the same shell session that runs agent.py. If the variable is missing, Agno raises an authentication error before sending the model request.
Confirm that the id value matches a model ID from the CometAPI Models page. You can also call CometAPI().get_available_models() to inspect model availability from your account.
Last modified on July 2, 2026