ospalabs
Guide · Dify

Dify token usage, and a price that stops the next call

Updated November 2026

Dify logs tokens on a message and can chart usage for an app. That is a report of calls the provider already answered. An open request from 2024 asked for a cost alert and a hard usage cap across models. It was closed without shipping one, and a dollar stop is still not part of the message log.

The provider key is the bill. On the model provider, set the OpenAI-compatible API base to Fuse and the credential to a Fuse key. Dify keeps its own token display. Fuse prices each call and refuses the one that would cross the ceiling.

  1. 01

    Add the provider key to Fuse

    Store the OpenAI, Anthropic, or other key on a Fuse project, enable the model ids your Dify apps use, and set a monthly ceiling plus a daily one if a single workflow can spike.

  2. 02

    Point Dify's model at Fuse

    In the model provider settings, set the API base URL to https://fuse.ospalabs.com/v1 and the API key to a Fuse key. The model name must match an enabled id exactly. Save, then send one message and confirm the row in the Fuse request log.

  3. 03

    Split apps with keys or tags

    A Fuse key per Dify app keeps a public chatbot from spending the internal workflow's budget. If every app shares one key, send a stable app id where the provider lets you set a header or user field so Customers can group it.

  4. 04

    Decide what the app does on 402

    The next model node fails. In the workflow, treat that error as the end of the run and show a message, instead of a retry loop that hammers the same refusal.

Questions

Does Dify's cloud credit cap my own provider key?
Dify-hosted model credit, where a plan includes it, is Dify's bill. A key you paste for OpenAI or another provider is that provider's bill. Fuse caps the key you pasted.
Will I lose Dify's token counts?
No. Dify still records the usage the model response includes. Fuse adds the dollar total and the refusal.