[Bug] Claude Haiku 4.5 pricing unit incorrect in OpenRouter provider config #800

Closed
opened 2026-02-16 10:20:32 -05:00 by yindo · 2 comments
Owner

Originally created by @alanhuang67 on GitHub (Nov 12, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.9.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Bug Description

The pricing configuration for Claude Haiku 4.5 in the OpenRouter provider has an incorrect unit value, causing the displayed pricing to be 1000x higher than the actual cost.

Current Configuration (Incorrect)

File: claude-haiku-4.5.yaml

pricing:
  input: '1'
  output: '5'
  unit: '0.001'      # ← INCORRECT
  currency: USD

This configuration results in:

  • Input: $1,000 per million tokens (should be $1)
  • Output: $5,000 per million tokens (should be $5)

Expected Configuration (Correct)

pricing:
  input: '1'
  output: '5'
  unit: '0.000001'   # ← CORRECT
  currency: USD

This should result in:

  • Input: $1 per million tokens ✓
  • Output: $5 per million tokens ✓

Evidence

The correct unit value can be verified by comparing with claude-sonnet-4-5.yaml, which correctly uses unit: '0.000001'.

Official Pricing References:

Impact

  • Users see incorrect cost estimates in Dify UI (1000x inflated)
  • May cause confusion and prevent users from selecting Claude Haiku 4.5
  • Affects cost calculation and billing estimation features

Proposed Fix

Change the unit value in claude-haiku-4.5.yaml from '0.001' to '0.000001' to match:

  1. Anthropic's official pricing
  2. OpenRouter's pricing
  3. Other Claude models' configuration pattern in Dify

Additional Context

  • All other Claude 4.x models (Sonnet 4.5, Opus 4.1, etc.) use unit: '0.000001' correctly
  • This appears to be a typo introduced when adding Claude Haiku 4.5 support
  • The issue exists in the OpenRouter provider configuration specifically

Environment

  • Dify Version: [Latest version from main branch]
  • Provider: OpenRouter
  • Affected Model: claude-haiku-4.5

Screenshots

[Attach your two screenshots showing the incorrect configuration in claude-haiku-4.5.yaml and the correct configuration in claude-sonnet-4-5.yaml]


<img width="950" height="611" alt="Image" src="https://github.com/user-attachments/assets/e6313be6-850b-455c-ad14-c9f9e6650ad4" />

---

## 提交说明

1. **Issue 标题**:

[Bug] Incorrect pricing unit for Claude Haiku 4.5 in OpenRouter provider (1000x inflated)

✔️ Expected Behavior

The pricing for Claude Haiku 4.5 should display as $1 per million input tokens and $5 per million output tokens, matching Anthropic's official pricing and OpenRouter's actual rates.

When users view the model pricing in Dify's UI or calculate token costs, the system should show:

  • Input cost: $1.00 / 1M tokens
  • Output cost: $5.00 / 1M tokens

For example, a conversation with:

  • 10,000 input tokens
  • 5,000 output tokens

Should cost: (10,000 × $1 / 1,000,000) + (5,000 × $5 / 1,000,000) = $0.01 + $0.025 = $0.035

Actual Behavior

Actual Behavior

The pricing currently displays as $1,000 per million input tokens and $5,000 per million output tokens due to incorrect unit: '0.001' configuration.

The same conversation example above would incorrectly show as costing $35.00 instead of $0.035 - a 1000x overestimation.

Originally created by @alanhuang67 on GitHub (Nov 12, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.9.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce ## Bug Description The pricing configuration for Claude Haiku 4.5 in the OpenRouter provider has an incorrect `unit` value, causing the displayed pricing to be 1000x higher than the actual cost. ## Current Configuration (Incorrect) **File**: `claude-haiku-4.5.yaml` ```yaml pricing: input: '1' output: '5' unit: '0.001' # ← INCORRECT currency: USD ``` This configuration results in: - Input: $1,000 per million tokens (should be $1) - Output: $5,000 per million tokens (should be $5) ## Expected Configuration (Correct) ```yaml pricing: input: '1' output: '5' unit: '0.000001' # ← CORRECT currency: USD ``` This should result in: - Input: $1 per million tokens ✓ - Output: $5 per million tokens ✓ ## Evidence The correct `unit` value can be verified by comparing with `claude-sonnet-4-5.yaml`, which correctly uses `unit: '0.000001'`. **Official Pricing References:** - [Anthropic Official Pricing](https://www.anthropic.com/api): $1/M input, $5/M output - [OpenRouter Claude Haiku 4.5](https://openrouter.ai/anthropic/claude-haiku-4.5): $1/M input, $5/M output ## Impact - Users see incorrect cost estimates in Dify UI (1000x inflated) - May cause confusion and prevent users from selecting Claude Haiku 4.5 - Affects cost calculation and billing estimation features ## Proposed Fix Change the `unit` value in `claude-haiku-4.5.yaml` from `'0.001'` to `'0.000001'` to match: 1. Anthropic's official pricing 2. OpenRouter's pricing 3. Other Claude models' configuration pattern in Dify ## Additional Context - All other Claude 4.x models (Sonnet 4.5, Opus 4.1, etc.) use `unit: '0.000001'` correctly - This appears to be a typo introduced when adding Claude Haiku 4.5 support - The issue exists in the OpenRouter provider configuration specifically ## Environment - Dify Version: [Latest version from main branch] - Provider: OpenRouter - Affected Model: claude-haiku-4.5 ## Screenshots [Attach your two screenshots showing the incorrect configuration in claude-haiku-4.5.yaml and the correct configuration in claude-sonnet-4-5.yaml] ``` <img width="950" height="611" alt="Image" src="https://github.com/user-attachments/assets/e6313be6-850b-455c-ad14-c9f9e6650ad4" /> --- ## 提交说明 1. **Issue 标题**: ``` [Bug] Incorrect pricing unit for Claude Haiku 4.5 in OpenRouter provider (1000x inflated) ### ✔️ Expected Behavior The pricing for Claude Haiku 4.5 should display as **$1 per million input tokens** and **$5 per million output tokens**, matching Anthropic's official pricing and OpenRouter's actual rates. When users view the model pricing in Dify's UI or calculate token costs, the system should show: - Input cost: $1.00 / 1M tokens - Output cost: $5.00 / 1M tokens For example, a conversation with: - 10,000 input tokens - 5,000 output tokens Should cost: (10,000 × $1 / 1,000,000) + (5,000 × $5 / 1,000,000) = $0.01 + $0.025 = **$0.035** ### ❌ Actual Behavior ## Actual Behavior The pricing currently displays as **$1,000 per million input tokens** and **$5,000 per million output tokens** due to incorrect `unit: '0.001'` configuration. The same conversation example above would incorrectly show as costing **$35.00** instead of **$0.035** - a 1000x overestimation.
yindo added the bug label 2026-02-16 10:20:32 -05:00
yindo closed this issue 2026-02-16 10:20:32 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 12, 2025):

Hi @alanhuang67! I'm Dosu and I’m helping the dify team.

You are correct: the current configuration for Claude Haiku 4.5 in the OpenRouter provider sets the pricing unit to '0.001', which causes a 1000x overestimation of token costs. This is inconsistent with both Anthropic's official pricing and the configuration for other Claude 4.x models like Sonnet 4.5, which use the correct unit: '0.000001' value. Updating the unit in claude-haiku-4.5.yaml to '0.000001' will align the cost calculations and UI display with the intended $1/M input and $5/M output pricing, matching both official and internal standards. No related pull requests or fixes are currently pending, so a direct update to the YAML config is needed to resolve this issue.
See the current config here.
Reference for correct config.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Nov 12, 2025): <!-- Greeting --> Hi @alanhuang67! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> You are correct: the current configuration for Claude Haiku 4.5 in the OpenRouter provider sets the pricing `unit` to `'0.001'`, which causes a 1000x overestimation of token costs. This is inconsistent with both Anthropic's official pricing and the configuration for other Claude 4.x models like Sonnet 4.5, which use the correct `unit: '0.000001'` value. Updating the `unit` in `claude-haiku-4.5.yaml` to `'0.000001'` will align the cost calculations and UI display with the intended $1/M input and $5/M output pricing, matching both official and internal standards. No related pull requests or fixes are currently pending, so a direct update to the YAML config is needed to resolve this issue. [See the current config here.](https://github.com/langgenius/dify-official-plugins/blob/a91c25746a97050a529bbabea2b30ec60fb74a4e/models/openrouter/models/llm/claude-haiku-4.5.yaml#L39-L43) [Reference for correct config.](https://github.com/langgenius/dify-official-plugins/blob/a91c25746a97050a529bbabea2b30ec60fb74a4e/models/openrouter/models/llm/claude-sonnet-4-5.yaml#L129-L133) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/5d8b305b-772a-4666-b164-4072d16ecfc0?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/5d8b305b-772a-4666-b164-4072d16ecfc0?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/5d8b305b-772a-4666-b164-4072d16ecfc0?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/5d8b305b-772a-4666-b164-4072d16ecfc0?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/5d8b305b-772a-4666-b164-4072d16ecfc0?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/5d8b305b-772a-4666-b164-4072d16ecfc0?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/5d8b305b-772a-4666-b164-4072d16ecfc0?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/28107)
Author
Owner

@dosubot[bot] commented on GitHub (Nov 12, 2025):

You’re correct—there’s a bug in the OpenRouter provider config for Claude Haiku 4.5: the pricing unit is set to 0.001 instead of the correct 0.000001, which causes a 1000x overestimation of token costs in Dify’s UI and billing estimates. Other Claude models like Sonnet 4.5 and Opus 4.1 use the correct unit value, so this issue is isolated to Haiku 4.5. The intended pricing should be $1 per million input tokens and $5 per million output tokens, matching Anthropic and OpenRouter’s official rates (source, source).

This misconfiguration was introduced when the model was added (source), and updating the unit to 0.000001 will fix the cost display and billing calculations. No other models are affected.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Nov 12, 2025): <!-- Answer --> You’re correct—there’s a bug in the OpenRouter provider config for Claude Haiku 4.5: the pricing unit is set to `0.001` instead of the correct `0.000001`, which causes a 1000x overestimation of token costs in Dify’s UI and billing estimates. Other Claude models like Sonnet 4.5 and Opus 4.1 use the correct unit value, so this issue is isolated to Haiku 4.5. The intended pricing should be $1 per million input tokens and $5 per million output tokens, matching Anthropic and OpenRouter’s official rates ([source](https://github.com/langgenius/dify-official-plugins/blob/a91c25746a97050a529bbabea2b30ec60fb74a4e/models/openrouter/models/llm/claude-haiku-4.5.yaml#L39-L43), [source](https://github.com/langgenius/dify-official-plugins/blob/a91c25746a97050a529bbabea2b30ec60fb74a4e/models/openrouter/models/llm/claude-sonnet-4-5.yaml#L129-L133)). This misconfiguration was introduced when the model was added ([source](https://github.com/langgenius/dify-official-plugins/pull/1910)), and updating the unit to `0.000001` will fix the cost display and billing calculations. No other models are affected. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/242743b2-b089-4482-87ff-f724eb67cb8b?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/242743b2-b089-4482-87ff-f724eb67cb8b?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/242743b2-b089-4482-87ff-f724eb67cb8b?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/242743b2-b089-4482-87ff-f724eb67cb8b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/242743b2-b089-4482-87ff-f724eb67cb8b?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/242743b2-b089-4482-87ff-f724eb67cb8b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/242743b2-b089-4482-87ff-f724eb67cb8b?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/2049)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#800