ai newsFr., 16. Okt.
EilmeldungFaraday Future bringt Humanoid-Roboter für 2.490 Dollar für Entwickler und Schulen

Dify: Claude und GPT über die OpenAI-kompatible API anbinden

Die Open-Source-Plattform Dify dient dem Aufbau von LLM-Anwendungen wie Chatbots, Agenten, Workflows und RAG-Apps. Der Zugang zu den Modellen läuft über Provider, die das OpenAI- oder Anthropic-Format sprechen.

dev.toFreitag 09:33 · 16.10.DE3 Min. Lesezeit
Bild: dev.to

Hinweis: Ich betreibe APIVAI, das Gateway, das in den folgenden Beispielen verwendet wird. Die Einrichtung ist bei jedem Endpunkt identisch, der das OpenAI- oder Anthropic-Format spricht.

Dify ist eine Open-Source-Plattform zur Entwicklung von LLM-Anwendungen: Chatbots, Agents, Workflows und Wissensdatenbank-Anwendungen (RAG). Der Zugriff auf Modelle erfolgt über Model-Provider-Plugins, und bei einem Drittanbieter-Gateway gibt es genug Felder, dass man leicht eines falsch ausfüllt. Dieser Beitrag geht die tatsächlichen Felder des offiziellen openai_api_compatible-Plugins von Dify (Version 0.0.68) sowie des anthropic-Plugins durch.

Beginnen wir mit OpenAI-API-compatible: Hier tippt man jede Modell-ID selbst ein, sodass ein neues Modell funktioniert, sobald das Gateway es anbietet.

Provider findet man auf der Model Provider-Seite: in der aktuellen Dify Cloud unter Integrations, in älteren selbst gehosteten Versionen unter Settings im Kontomenü. Jeder Provider gilt für den gesamten Workspace, und nur Owners und Admins können ihn ändern.

Öffnen Sie Model Provider, suchen Sie OpenAI-API-compatible in der Liste der installierbaren Provider (oder im Dify Marketplace) und klicken Sie auf Install.

Auf der Karte OpenAI-API-compatible klicken Sie auf Add Model und füllen Folgendes aus:

Lassen Sie den Rest auf den Standardeinstellungen. Ältere Versionen des Plugins nennen das Adressfeld API endpoint URL; der Wert ist derselbe.

Wenn Sie auf Save klicken, sendet Dify eine Testanfrage und speichert nur, wenn diese erfolgreich ist. Wiederholen Sie Add Model für jedes gewünschte Modell, mit demselben Key und derselben Adresse, zum Beispiel gpt-5.5 und claude-haiku-4-5.

curl https://api.apivai.com/v1/models -H "Authorization: Bearer your-key" Enter fullscreen mode Exit fullscreen mode Schritt 3: Die Modelle verwenden Wählen Sie im Modellselector einer App Ihr Modell unter OpenAI-API-compatible und setzen Sie Max Tokens auf 4096 oder mehr. In einem Workflow wählt jeder LLM-Knoten sein eigenes Modell, sodass günstige und starke Modelle im selben Ablauf eingesetzt werden können. Setzen Sie unter Default Models auf der Model Provider-Seite das System Reasoning Model als Workspace-Standard.

Alternative: das Anthropic-Plugin für Claude Installieren Sie das Anthropic-Plugin und öffnen Sie dessen Konfiguration. Setzen Sie API Key auf Ihren Key und API URL auf https://api.apivai.com. Fügen Sie nicht /v1 hinzu; der Anthropic-Client des Plugins hängt /v1/messages selbst an.

Lassen Sie Enable request metadata auf Disabled. Einige IDs in der eingebauten Modellliste des Plugins entsprechen denen des Gateways (zum Beispiel claude-sonnet-4-6); andere tragen abweichende oder ältere Namen. Wenn ein Modell fehlt oder einen "model not found"-Fehler zurückgibt, klicken Sie auf der Anthropic-Karte auf Add Model und tippen die exakte ID ein.

Welches Modell wofür Question Classifier-Knoten, Extraktion, Q&A mit hohem Volumen: claude-haiku-4-5 oder gpt-6-luna Standard für Chatbots und Agents: claude-sonnet-4-6 Agents mit vielen Tools, lange Dokumente: claude-sonnet-5-5 Nur die härtesten Reasoning-Knoten: claude-opus-5-5 Ein Routing-Workflow, bei dem ein günstiges Modell zuerst klassifiziert und die schweren Fälle dann an ein starkes weitergibt, ist der gängigste Weg, die Dify-Kosten niedrig zu halten.

Zum Zeitpunkt der Erstellung dieses Artikels liegen die meisten Claude-Modelle bei APIVAI 56 bis 58 Prozent unter den offiziellen Preisen von Anthropic und die GPT-Modelle bis zu 86 Prozent unter denen von OpenAI; zum Beispiel kostet Claude Sonnet 4.6 1,26 / 6,32 Dollar pro Million Input-/Output-Tokens, gegenüber den offiziellen 3 / 15 Dollar. Die Abrechnung erfolgt prepaid und pro Token, ohne Abonnement. Die vollständige Tabelle finden Sie unter https://apivai.com/pricing.

Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.

Original (Englisch) anzeigen

Disclosure: I run APIVAI, the gateway used in the examples below. The setup is the same for any endpoint that speaks the OpenAI or Anthropic format.

Dify is an open-source platform for building LLM apps: chatbots, agents, workflows and knowledge-base (RAG) apps. It reaches models through model provider plugins, and with a third-party gateway there are enough fields that it's easy to fill one in wrong. This post goes through the actual fields of Dify's official openai_api_compatible plugin (version 0.0.68) and the anthropic plugin.

Start with OpenAI-API-compatible: you type each model ID yourself, so a new model works as soon as the gateway lists it.

Providers live on the Model Provider page: under Integrations in current Dify Cloud, under Settings in the account menu in older self-hosted versions. Each provider applies to the whole workspace, and only owners and admins can change it.

Open Model Provider, find OpenAI-API-compatible in the list of providers you can install (or on the Dify Marketplace ) and click Install.

On the OpenAI-API-compatible card, click Add Model and fill in:

Leave the rest at their defaults. Older versions of the plugin call the address field API endpoint URL; the value is the same.

When you click Save, Dify sends a test request and only saves if it passes. Repeat Add Model for each model you want, with the same key and address, for example gpt-5.5 and claude-haiku-4-5.

curl https://api.apivai.com/v1/models -H "Authorization: Bearer your-key" Enter fullscreen mode Exit fullscreen mode Step 3: Use the models In an app's model selector, pick your model under OpenAI-API-compatible and set Max Tokens to 4096 or more. In a workflow, each LLM node picks its own model, so cheap and strong models can sit in the same flow. Under Default Models on the Model Provider page, set the System Reasoning Model as the workspace default.

Alternative: the Anthropic plugin for Claude Install the Anthropic plugin and open its setup. Set API Key to your key and API URL to https://api.apivai.com. Do not add /v1; the plugin's Anthropic client appends /v1/messages itself.

Leave Enable request metadata on Disabled. Some IDs in the plugin's built-in model list match the gateway's (such as claude-sonnet-4-6 ); others have different or dated names. If a model is missing or returns "model not found", click Add Model on the Anthropic card and type the exact ID.

Which model for which job Question Classifier nodes, extraction, high-volume Q&A: claude-haiku-4-5 or gpt-6-luna Default for chatbots and agents: claude-sonnet-4-6 Agents with many tools, long documents: claude-sonnet-5-5 Only the hardest reasoning nodes: claude-opus-5-5 A routing workflow (a cheap model classifies first, then hands the hard cases to a strong one) is the most common way to keep Dify costs down.

At the time of writing, most Claude models on APIVAI are 56–58% below Anthropic's list prices and GPT models up to 86% below OpenAI's; for example, Claude Sonnet 4.6 is $1.26 / $6.32 per million input / output tokens against the official $3 / $15. It's prepaid and billed per token, with no subscription. The full table is at https://apivai.com/pricing.

Originaltitel: Dify with Claude and GPT: every field of the OpenAI-API-compatible plugin, explainedQuelle: dev.to (dev.to). Original öffnen