Skip to content

No usage/cost shown for DeepInfra provider (openai-compatible) #45483

Closed as not planned

Description

@Tobias-Conrad

Description

When using DeepInfra (https://deepinfra.com/) as a provider, opencode shows no token usage and no cost in the TUI / stats / session sidebar. The same setup works correctly with Anthropic (Claude), DeepSeek and OpenRouter — usage and cost display fine there. DeepInfra is the only one that shows nothing.

Setup

DeepInfra is configured as an OpenAI-compatible provider (@ai-sdk/openai-compatible), baseURL https://api.deepinfra.com/v1, e.g.:

"provider": {
  "deepinfra": {
    "npm": "@ai-sdk/openai-compatible",
    "options": { "baseURL": "https://api.deepinfra.com/v1" },
    "models": { "deepseek-ai/DeepSeek-V4-Flash-0731": { "name": "DS Flash DI", "tool_call": true, "reasoning": true } }
  }
}

Expected

Usage (prompt/completion tokens, cached tokens) and cost are reported for the DeepInfra provider, like they are for OpenRouter/DeepSeek.

Actual

No usage / cost is shown for DeepInfra at all.

Environment

  • opencode (OpenChamber UI)
  • macOS
  • Provider: DeepInfra via OpenAI-compatible adapter

Related

Activity

  1. Tobias-Conrad commented on Sep 16, 2026

    @Tobias-Conrad
    Author

    Cross-reference: the DeepInfra account balance now shows in OpenChamber's Usage panel (openchamber/openchamber#3600) via GET https://api.deepinfra.com/v1/me?checklist=true → checklist.stripe_balance. That covers the balance surface; the per-request token/cost reporting for @ai-sdk/openai-compatible providers in the TUI is separate and still open here.

  2. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the report! A few details would help us look into this:

    1. OpenCode version: the output of opencode --version.
    2. Does it happen in OpenCode itself? You mention OpenChamber, which is a separate third-party UI. Do you see the same thing in the plain opencode TUI (session sidebar) or with opencode stats? If it only happens in OpenChamber, the problem is probably there.
    3. Tokens, cost or both? Are the token counts (input/output/cache) missing, or only the cost? One thing to know: OpenCode works out cost from the token counts and the model's per-token rates. Your custom deepinfra model has no cost entry, so its cost will show as $0 even when tokens are tracked. You can add the rates to the model config, for example:
      "cost": { "input": 0.27, "output": 1.1, "cache_read": 0.07 }
      (values in USD per 1M tokens; use DeepInfra's actual prices).

    You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it, so we know you're done.

    Related issues I found, ordered from most to least likely to be relevant:

  3. opencodejr commented on Oct 31, 2026

    @opencodejr
    Contributor

    Closing this for now because we haven't heard back. To look into the missing DeepInfra usage and cost, we'd need your OpenCode version (opencode --version). We'd also need to know whether it happens in the plain opencode TUI or opencode stats, or only in OpenChamber, and whether the token counts or only the cost are missing.

    A quick tip in the meantime: OpenCode works out cost from the model's per-token rates. A custom model with no cost entry in its config will always show $0. Adding "cost": { "input": ..., "output": ..., "cache_read": ... } (USD per 1M tokens) to the model may be enough.

    If it still happens, please comment here with those details or open a new issue, and we'll take another look. Thanks!

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions