{"slug": "dify-with-claude-and-gpt-every-field-of-the-openai-api-compatible-plugin", "title": "Dify with Claude and GPT: every field of the OpenAI-API-compatible plugin, explained", "summary": "A developer running the APIVAI gateway published a field-by-field guide to configuring Dify's official openai_api_compatible plugin (v0.0.68) and anthropic plugin, covering the API Base URL, model ID, context size, function-call and API-type settings needed to route Claude and GPT models through a single OpenAI-compatible endpoint. The writeup notes that Dify validates each model with a test request before saving and that the Anthropic plugin appends /v1/messages itself, so the address field should omit that path. It also cites gateway pricing of $1.26/$6.32 per million input/output tokens for Claude Sonnet 4.6 versus Anthropic's official $3/$15.", "body_md": "*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.*\n\n[Dify](https://docs.dify.ai) 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.\n\n| Plugin | Address field | Models | Best for | \n|---|---|---|---|\n| **OpenAI-API-compatible** | API Base URL: `https://api.apivai.com/v1` | Claude and GPT | One provider for every model; you type the model IDs | \n| **Anthropic** | API URL: `https://api.apivai.com` | Claude only | Claude only, in the native format with prompt caching | \n\nStart with **OpenAI-API-compatible**: you type each model ID yourself, so a new model works as soon as the gateway lists it.\n\nProviders 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.\n\nOpen **Model Provider**, find **OpenAI-API-compatible** in the list of providers you can install (or on the [Dify Marketplace](https://marketplace.dify.ai/)) and click **Install**.\n\nOn the **OpenAI-API-compatible** card, click **Add Model** and fill in:\n\n| Field | Value | \n|---|---|\n| **Model Type** | LLM | \n| **Model Name** | `claude-sonnet-4-6` (the exact model ID) | \n| **Model display name** | optional, e.g. \"Claude Sonnet 4.6\" | \n| **API Key** | your key | \n| **API Base URL** | `https://api.apivai.com/v1` | \n| **model name for API endpoint** | leave empty | \n| **Completion mode** | Chat | \n| **Model context size** | no larger than the model's context window | \n| **Upper bound for max tokens** | 8192 or more | \n| **Function Call Type** | Tool Call | \n| **Stream function calling** | Support | \n| **API Type** | Chat Completions API (/chat/completions) | \n\nLeave the rest at their defaults. Older versions of the plugin call the address field **API endpoint URL**; the value is the same.\n\nThe fields people most often misread:\n\nWhen 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`.\n\nTake model IDs from the API:\n\n```\ncurl https://api.apivai.com/v1/models -H \"Authorization: Bearer your-key\"\n```\n\n`https://api.apivai.com`. Do `/v1`; the plugin's Anthropic client appends `/v1/messages` itself. Leave `claude-sonnet-4-6`); others have different or dated names. If a model is missing or returns \"model not found\", click `claude-haiku-4-5` or `gpt-6-luna`\n`claude-sonnet-5-5`\n`claude-opus-5-5`\nA 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.\n\n`https://api.apivai.com/v1`, without `/chat/completions`; the Anthropic plugin needs 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](https://apivai.com/pricing).\n\nQuestions are welcome in the comments.", "url": "https://wpnews.pro/news/dify-with-claude-and-gpt-every-field-of-the-openai-api-compatible-plugin", "canonical_source": "https://dev.to/mupromax/dify-with-claude-and-gpt-every-field-of-the-openai-api-compatible-plugin-explained-4995", "published_at": "2026-10-16 07:33:36+00:00", "updated_at": "2026-10-16 07:39:07.423932+00:00", "lang": "en", "topics": ["ai-tools", "large-language-models", "ai-agents", "developer-tools"], "entities": ["Dify", "APIVAI", "Anthropic", "OpenAI", "Claude", "GPT", "Dify Marketplace"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/dify-with-claude-and-gpt-every-field-of-the-openai-api-compatible-plugin", "markdown": "https://wpnews.pro/news/dify-with-claude-and-gpt-every-field-of-the-openai-api-compatible-plugin.md", "text": "https://wpnews.pro/news/dify-with-claude-and-gpt-every-field-of-the-openai-api-compatible-plugin.txt", "jsonld": "https://wpnews.pro/news/dify-with-claude-and-gpt-every-field-of-the-openai-api-compatible-plugin.jsonld"}}