cometapi provider that calls CometAPI through OpenAI-compatible endpoints.
Prerequisites
- Node.js 18+
- Promptfoo installed locally or run through
npx - A CometAPI account with an active API key — get yours in the dashboard
- A model ID from the CometAPI Models page
Configure the integration
1
Set your CometAPI API key
Set
COMETAPI_KEY before you run evaluations:2
Choose a provider format
Promptfoo uses the following provider ID format for CometAPI:Use these provider types:
You can also use
cometapi:your-model-id for the default chat mode.3
Run a CLI evaluation
The following command runs a one-prompt chat evaluation:
4
Create a Promptfoo config file
The following Run the config file with Promptfoo:
promptfooconfig.yaml evaluates the same prompt against a CometAPI model:Provider examples
Use a provider type that matches the model behavior that you want to evaluate:chat provider type and pass image variables through Promptfoo test variables.
Troubleshooting
Promptfoo cannot find the API key
Promptfoo cannot find the API key
Confirm that
COMETAPI_KEY is exported in the same shell session that runs promptfoo eval.The provider type does not match the model
The provider type does not match the model
Use
chat for conversational and multimodal models, embedding for embedding models, and image for image generation models.The model ID fails
The model ID fails
Replace
your-model-id with an exact model ID from the CometAPI Models page.