# Credits Consumption by Feature

> How Runcell credits are calculated for Ask/Chat, Agent, completions, and other AI features

Canonical HTML: https://www.runcell.dev/docs/credits-consumption-by-feature

## Overview

Runcell uses **Credits** to account for AI feature usage. The current billing model is split by feature type:

* **Ask/Chat and Agent**: token-based. Credits are calculated from provider-reported regular input, cache-read, cache-write, and output tokens for the selected model.
* **Other AI features**: standard feature-based pricing. These features still use fixed or model-rate-based rules rather than token-based billing.

For token-based model rates, see [Token-based Credits](https://www.runcell.dev/docs/token-based-credits.md).

## Ask/Chat and Agent

Ask/Chat and Agent mode no longer use the old per-message `base credits × model rate` calculation. They now calculate the provider-equivalent token cost and convert it at `30 Credits / USD`:

```text
billable_cost_usd = regular_input_cost + cache_read_cost + cache_write_cost + output_cost

raw_credits = billable_cost_usd * 30

total_credits = ceil(raw_credits / 0.01) * 0.01
```

The final deduction has a minimum of `0.01 Credit` when the request has billable usage. Cache-read and cache-write tokens use the selected model's separate provider rates, so there is no universal cache discount. The pre-request `1 Credit` balance check for Ask/Chat and Agent is only a minimum balance gate, not an automatic one-credit charge. The final deduction uses actual usage after the provider response is available.

## Credits Consumption Summary by Feature

| Feature                    | Credits per Request                             | Calculation Method    | Notes                                                                         |
| -------------------------- | ----------------------------------------------- | --------------------- | ----------------------------------------------------------------------------- |
| **Ask/Chat**               | Based on actual provider-reported token buckets | Token-based           | Uses selected model input, output, cache-read, and cache-write rates          |
| **Agent**                  | Based on actual provider-reported token buckets | Token-based           | Uses selected model token rates across the full tool workflow                 |
| **Inline Completion**      | `0.05`                                          | Fixed                 | Fixed value, not affected by model selection                                  |
| **Simple Completion**      | `0.1`                                           | Fixed                 | Fixed value, not affected by model selection                                  |
| **Code Apply**             | `0.1`                                           | Fixed                 | Fixed value for both insert and edit actions                                  |
| **Image Generation**       | `5 × model_rate`                                | Dynamic (model-based) | Base credits configurable via `IMAGE_GENERATION_CREDITS` env var (default: 5) |
| **Quick Fix**              | `1 × model_rate`                                | Dynamic (model-based) | Base 1 credit multiplied by model's credit\_rate                              |
| **Predictive Interaction** | `0.5`                                           | Fixed                 | Fixed value for both streaming and non-streaming modes                        |
| **Visualization Analysis** | `0.3`                                           | Fixed                 | Fixed value for image analysis feature                                        |
| **Title Generation**       | `0`                                             | Free                  | No credits deducted                                                           |

## Standard Feature-based Costs

The features below are **not** currently token-based:

* Inline Completion
* Simple Completion
* Code Apply
* Image Generation
* Quick Fix
* Predictive Interaction
* Visualization Analysis
* Title Generation

These features continue to use the standard fixed or model-rate-based rules shown in the table above. This keeps short, background, or utility actions predictable even when they are powered by AI.

## Archived Legacy Model Rates

The old message-based model-rate documentation is archived for historical reference: [Archived Model Credit Costs](https://www.runcell.dev/docs/model-credits.md).

Use that archived page only when you need to understand legacy model-rate multipliers. For current Ask/Chat and Agent costs, use [Token-based Credits](https://www.runcell.dev/docs/token-based-credits.md).
