# How the Forge ZSH Theme Displays Cost Information: Environment Variable Configuration

> Learn how the Forge ZSH theme shows session cost in your terminal. Discover environment variables for currency symbol and conversion rate in antinomyhq/forgecode.

- Repository: [Forge Code/forgecode](https://github.com/antinomyhq/forgecode)
- Tags: how-to-guide
- Published: 2026-04-08

---

**The Forge ZSH theme displays session cost in your terminal's right prompt by multiplying raw USD costs by the `FORGE_CURRENCY_CONVERSION_RATE` and prefixing the result with the `FORGE_CURRENCY_SYMBOL`, both controlled through environment variables in the antinomyhq/forgecode repository.**

The Forge ZSH theme provides real-time cost visibility for AI-powered coding sessions by rendering token usage and associated costs directly in your terminal's right prompt. This functionality is implemented in the `ZshRPrompt` struct within the antinomyhq/forgecode codebase, which conditionally formats cost information only when active sessions have non-zero token counts and associated cost data from the provider.

## How Cost Information Appears in the Right Prompt

The right prompt (`RPROMPT`) integration resides in [`crates/forge_main/src/zsh/rprompt.rs`](https://github.com/antinomyhq/forgecode/blob/main/crates/forge_main/src/zsh/rprompt.rs), where the `ZshRPrompt` struct handles all formatting logic. When a session has a non-zero token count, the prompt displays three elements: an agent icon with name, the token count, and the session cost.

### The ZshRPrompt Struct

The `ZshRPrompt` struct is defined in [`crates/forge_main/src/zsh/rprompt.rs`](https://github.com/antinomyhq/forgecode/blob/main/crates/forge_main/src/zsh/rprompt.rs) and manages the visual presentation of session metadata. It stores the `currency_symbol` as a `String` and the `conversion_ratio` as a decimal value that transforms the raw cost before display.

### Conditional Cost Rendering Logic

Cost information appears only when both conditions are met: the session contains tokens (`active` is true) and the cost field contains a value. The rendering logic at lines 100-107 of [`rprompt.rs`](https://github.com/antinomyhq/forgecode/blob/main/rprompt.rs) implements this check:

```rust
// crates/forge_main/src/zsh/rprompt.rs (lines 100-107)
if let Some(cost) = self.cost && active {
    let converted_cost = cost * self.conversion_ratio;
    let cost_str = format!("{}{:.2}", self.currency_symbol, converted_cost);
    write!(f, " {}", cost_str.zsh().fg(ZshColor::GREEN).bold())?;
}

```

This code multiplies the raw cost by the `conversion_ratio`, formats the result to two decimal places with the `currency_symbol` prefix, and applies **green** bold styling before appending it to the prompt.

## Environment Variables That Control Currency Display

Two specific environment variables control how costs are presented in the ZSH theme. These values populate the `ForgeConfig` struct defined in [`crates/forge_config/src/config.rs`](https://github.com/antinomyhq/forgecode/blob/main/crates/forge_config/src/config.rs) (lines 269-279) and are accessed by `ZshRPrompt::from_config` at lines 39-45 of [`rprompt.rs`](https://github.com/antinomyhq/forgecode/blob/main/rprompt.rs).

### FORGE_CURRENCY_SYMBOL

The `FORGE_CURRENCY_SYMBOL` environment variable sets the `currency_symbol` field in the configuration, defaulting to `"$"` when unset. This symbol prefixes the converted cost value in the right prompt display.

### FORGE_CURRENCY_CONVERSION_RATE

The `FORGE_CURRENCY_CONVERSION_RATE` environment variable controls the `currency_conversion_rate` field, defaulting to `1.0`. This decimal multiplier converts the raw USD cost (as returned by the API) to your preferred currency denomination before formatting.

The `from_config` method in `ZshRPrompt` demonstrates how these configuration values bridge the global configuration and the display layer:

```rust
// crates/forge_main/src/zsh/rprompt.rs (lines 39-45)
pub fn from_config(config: &ForgeConfig) -> Self {
    Self::default()
        .currency_symbol(config.currency_symbol.clone())
        .conversion_ratio(config.currency_conversion_rate.value())
}

```

## Practical Configuration Examples

The following examples demonstrate how to configure the Forge ZSH theme for different currency displays using environment variables.

### Default USD Display

With no environment variables set, the theme defaults to USD with a conversion rate of 1.0:

```bash

# Default configuration

forge commit

# RPROMPT displays:   FORGE 1.5k $0.01  gpt-4

```

The `$0.01` indicates the raw USD cost multiplied by `1.0` and prefixed with the default `$` symbol.

### Displaying Costs in Indian Rupees

To display costs in INR with an appropriate conversion rate:

```bash
export FORGE_CURRENCY_SYMBOL="₹"
export FORGE_CURRENCY_CONVERSION_RATE=83.5

forge commit

# RPROMPT displays:   FORGE 1.5k ₹0.83  gpt-4

```

A raw cost of `$0.01` becomes `₹0.83` after multiplication by `83.5` and rounding to two decimal places.

### Disabling Nerd Fonts While Preserving Currency

The currency display operates independently of Nerd Font icons. Disabling Nerd Fonts affects agent and model icons but leaves cost formatting intact:

```bash
export NERD_FONT=0
export FORGE_CURRENCY_SYMBOL="€"
export FORGE_CURRENCY_CONVERSION_RATE=0.92

forge commit

# RPROMPT displays:  FORGE 1.5k €0.01 gpt-4

```

### Sessions Without Cost Data

When the provider does not return cost information, the currency section is omitted entirely while other elements remain:

```bash
forge command-with-no-cost

# RPROMPT displays:   FORGE 2.3k   gpt-4

# Note the absence of the currency segment

```

## Summary

- The **Forge ZSH theme** displays session costs in the right prompt via the `ZshRPrompt` struct in [`crates/forge_main/src/zsh/rprompt.rs`](https://github.com/antinomyhq/forgecode/blob/main/crates/forge_main/src/zsh/rprompt.rs).
- Cost display requires both an active session (non-zero tokens) and a populated `cost` field from the provider.
- **FORGE_CURRENCY_SYMBOL** controls the currency prefix (default: `"$"`).
- **FORGE_CURRENCY_CONVERSION_RATE** multiplies the raw USD cost before display (default: `1.0`).
- The conversion formula `cost * conversion_ratio` produces the final displayed value, formatted to two decimal places with green bold styling.
- Currency display is independent of Nerd Font settings (`NERD_FONT` or `USE_NERD_FONT`).

## Frequently Asked Questions

### How do I change the currency symbol in the Forge ZSH theme?

Set the `FORGE_CURRENCY_SYMBOL` environment variable to your desired symbol (e.g., `export FORGE_CURRENCY_SYMBOL="€"`). This overrides the default `"$"` value and applies immediately to new prompt renderings without requiring shell restarts.

### Why is my cost showing as $0.00 even though I set a conversion rate?

The conversion rate multiplies the raw USD cost; if the base cost is very small (e.g., $0.0001), multiplying by typical conversion rates may still result in a value below 0.005, which rounds to `0.00` when formatted to two decimal places. Ensure your provider returns granular cost data or adjust expectations for very low-cost operations.

### Does disabling Nerd Fonts affect the currency display?

No. The `NERD_FONT` and `USE_NERD_FONT` environment variables only control agent and model icons. The currency symbol from `FORGE_CURRENCY_SYMBOL` and cost formatting remain fully functional regardless of Nerd Font settings.

### Where does the raw cost value originate before conversion?

The raw cost comes from the active conversation session data populated by the Forge engine when processing LLM requests. The `ZshRPrompt` struct receives this value through its `cost` field, then applies the conversion ratio and symbol formatting before displaying it in your terminal's right prompt.