Skip to main content

Documentation Index

Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt

Use this file to discover all available pages before exploring further.

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:
pip install -U agno
2

Set your CometAPI API key

Store your CometAPI API key in the COMETAPI_KEY environment variable:
read -rsp "CometAPI API key: " COMETAPI_KEY
printf '\n'
export COMETAPI_KEY
3

Create an Agno agent

Use Agno’s official CometAPI provider:
from agno.agent import Agent
from agno.models.cometapi import CometAPI

agent = Agent(
    model=CometAPI(id="your-model-id"),
    markdown=True,
)

agent.print_response("Write a short product update in three bullet points.")
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:
python agent.py
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:
import os

from agno.agent import Agent
from agno.models.cometapi import CometAPI

agent = Agent(
    model=CometAPI(
        id="your-model-id",
        api_key=os.environ["COMETAPI_KEY"],
        base_url="https://api.cometapi.com/v1",
    )
)

agent.print_response("Summarize the benefits of a unified AI API.")

List available models

Agno’s provider exposes get_available_models() for checking the model IDs available through your CometAPI account:
from agno.models.cometapi import CometAPI

model = CometAPI()
available_models = model.get_available_models()
print(available_models)

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.