Skip to content

Latest commit

 

History

History
76 lines (52 loc) · 3.62 KB

File metadata and controls

76 lines (52 loc) · 3.62 KB

Connect Dify to CometAPI

Canonical docs: https://apidoc.cometapi.com/integrations/dify

Use this guide to connect Dify to CometAPI by setting the base URL, API key, and model or provider options. Dify is an open-source LLM application development platform. By connecting it to CometAPI, you can use current CometAPI model IDs inside Dify's workflow, chatbot, and agent builders.

Prerequisites

Method 1: CometAPI plugin (recommended)

The easiest way to connect. Dify Marketplace provides an official CometAPI plugin that handles the integration automatically.

Get your CometAPI API key

Log in to the CometAPI dashboard. Click Add API Key and copy your key.

CometAPI dashboard showing the Add API Key button and key list

CometAPI API key details showing the base URL https://api.cometapi.com

Install the CometAPI plugin in Dify

In Dify, go to PluginsInstall PluginMarketplace. Search for cometapi and install it.

Dify plugin marketplace search results showing the CometAPI plugin

CometAPI plugin installation confirmation dialog in Dify

Add your API key

Go to SettingsModel ProviderCometAPIOpen Settings. Paste your CometAPI API key and click Save.

Add models

Enter a model ID from the CometAPI Models page and click Add.

Dify model provider settings showing the CometAPI configuration form

Dify model list with CometAPI models successfully added

Test the connection

Create a chatbot or workflow and select a CometAPI model. Send a test message — a successful response confirms the integration is working.

Dify chat interface showing a successful response from a CometAPI model

Method 2: OpenAI-compatible provider

Use this method to add models not covered by the CometAPI plugin, such as Claude, Grok, or Gemini — or to use custom model names.

Open model provider settings

Go to SettingsModel ProviderOpenAI-API-compatibleAdd Model.

Configure the model

Fill in the following fields:

Field Value
Model type LLM
Model name Model ID from CometAPI (must match exactly)
API key Your CometAPI API key
API base URL https://api.cometapi.com/v1

Click Save.

Dify OpenAI-compatible provider form with CometAPI values filled in

Dify model list showing a newly saved CometAPI-compatible model entry

Tip For model identifiers, refer to the CometAPI Models page. The model ID in Dify must exactly match the identifier used in CometAPI.

Troubleshooting

The API key fails

Confirm that the API key is correct and has available balance.

The model ID fails

Confirm that the model ID matches exactly what CometAPI expects.

The API base URL fails

Confirm that the API base URL includes /v1 for the OpenAI-compatible method.

Further help

Visit the CometAPI support page.