Skip to content

fix(openai): correct stale pricing for gpt-4o family and gpt-5.x pro/5.5#3176

Open
KartikMouli wants to merge 1 commit into
langgenius:mainfrom
KartikMouli:fix/openai-pricing
Open

fix(openai): correct stale pricing for gpt-4o family and gpt-5.x pro/5.5#3176
KartikMouli wants to merge 1 commit into
langgenius:mainfrom
KartikMouli:fix/openai-pricing

Conversation

@KartikMouli
Copy link
Copy Markdown

Summary

Several models in the OpenAI provider have stale or incorrect pricing in their YAMLs. The most impactful is the gpt-4ochatgpt-4o-latest swap that has been live since the v1.0.0 plugin migration — anyone using Dify's usage stats for gpt-4o has been billed against double the actual rate. This PR corrects 7 YAMLs against OpenAI's current official pricing.

All values verified against https://developers.openai.com/api/docs/pricing (the current official OpenAI pricing page) and https://platform.openai.com/docs/models.

Pricing corrections

File Before (in/out) After (in/out) Notes
models/openai/models/llm/gpt-4o.yaml 5.00 / 15.00 2.50 / 10.00 Post Aug 6 2024 standard rate; matches Azure plugin's gpt-4o
models/openai/models/llm/chatgpt-4o-latest.yaml 2.50 / 10.00 5.00 / 15.00 chat-latest (ChatGPT model) is priced higher than gpt-4o; values look swapped with above
models/openai/models/llm/gpt-4o-audio-preview.yaml 5.00 / 15.00 2.50 / 10.00 Text I/O matches gpt-4o; audio I/O is metered separately
models/openai/models/llm/gpt-4o-audio-preview-2025-06-03.yaml 5.00 / 15.00 2.50 / 10.00 Same
models/openai/models/llm/gpt-5.5.yaml 5.00 / 22.50 5.00 / 30.00 Output rate per OpenAI pricing page
models/openai/models/llm/gpt-5.5-pro.yaml 15.00 / 90.00 30.00 / 180.00 Pro tier matches gpt-5.4-pro structure
models/openai/models/llm/gpt-5.4-pro.yaml 30.00 / 135.00 30.00 / 180.00 Output rate per OpenAI pricing page

The latter three were introduced in #2981 (merged 2026-04-26) which added the GPT-5.5 family; the values appear to have been estimated before final pricing was published.

Why this matters

gpt-4o is one of the most widely used models on Dify. The current 5.00 / 15.00 configuration causes Dify's cost-estimation UI and token-spend dashboards to display 2× the actual OpenAI bill. The reverse is true for chatgpt-4o-latest (showing 50% of the actual cost). This has been quietly wrong since the v1.0.0 plugin migration (Feb 2025).

This PR contains Changes to Non-Plugin

  • Documentation
  • Other

This PR contains Changes to Non-LLM Models Plugin

  • I have Run Comprehensive Tests Relevant to My Changes

This PR contains Changes to LLM Models Plugin

  • My Changes Affect Message Flow Handling (System Messages and User→Assistant Turn-Taking)
  • My Changes Affect Tool Interaction Flow (Multi-Round Usage and Output Handling, for both Agent App and Agent Node)
  • My Changes Affect Multimodal Input Handling (Images, PDFs, Audio, Video, etc.)
  • My Changes Affect Multimodal Output Generation (Images, Audio, Video, etc.)
  • My Changes Affect Structured Output Format (JSON, XML, etc.)
  • My Changes Affect Token Consumption Metrics
  • My Changes Affect Other LLM Functionalities (Reasoning Process, Grounding, Prompt Caching, etc.)
  • Other Changes (Add New Models, Fix Model Parameters etc.)

YAML pricing fields only — no runtime/behavior changes. Token consumption metrics shown in the Dify UI and exposed via APIs will now reflect actual OpenAI billing for affected models.

Version Control

  • I have Bumped Up the Version in Manifest.yaml (models/openai/manifest.yaml: 0.4.0 → 0.4.1, PATCH for backwards-compatible fix)

Dify Plugin SDK Version

  • I have Ensured dify_plugin>=0.3.0,<0.6.0 is in requirements.txt (no SDK changes in this PR)

Environment Verification

SaaS Environment

  • Pricing values cross-referenced against OpenAI's official pricing page; YAML-only change with no runtime behavior modified. Following the pattern of the merged precedent fix(gemini): update pricing configuration for Gemini models #2674 (fix(gemini): update pricing configuration for Gemini models) which made an analogous pricing-only YAML correction.

Updates per https://developers.openai.com/api/docs/pricing and
https://platform.openai.com/docs/models:

- gpt-4o: 5.00/15.00 -> 2.50/10.00 (post-2024-08-06 standard price)
- chatgpt-4o-latest: 2.50/10.00 -> 5.00/15.00 (chat-latest premium)
- gpt-4o-audio-preview, gpt-4o-audio-preview-2025-06-03:
  5.00/15.00 -> 2.50/10.00 (text I/O matches gpt-4o)
- gpt-5.5: output 22.50 -> 30.00
- gpt-5.5-pro: 15.00/90.00 -> 30.00/180.00
- gpt-5.4-pro: output 135.00 -> 180.00

Bumps openai plugin to 0.4.1.
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label May 21, 2026
@KartikMouli KartikMouli deployed to models/openai May 21, 2026 20:27 — with GitHub Actions Active
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the OpenAI plugin version to 0.4.1 and adjusts the pricing configuration for several models, including ChatGPT-4o, GPT-4o, and the GPT-5 series. A review comment identifies a missing trailing newline in the gpt-4o-audio-preview-2025-06-03.yaml file, suggesting its addition for POSIX compliance and consistency.

input: '2.50'
output: '10.00'
unit: '0.000001'
currency: USD No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The file is missing a trailing newline. Adding a newline at the end of the file ensures consistency with other model configuration files in this repository and adheres to standard POSIX formatting practices.

  currency: USD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant