# IVoicePricingReader

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.ivoicepricingreader/
> Summary: IVoicePricingReader: Reads the configured voice model's pricing.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Abstractions.dll</code></div>

Reads the configured voice model's pricing.

```csharp
public interface IVoicePricingReader
```

## Remarks

The HTTP layer uses this abstraction to show voice pricing; pricing
resolution is inside `Tracon.Voice`, and the HTTP layer cannot
reference that package (the package direction rule). Tracon does not
fabricate a price: if there is no match, [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) is
returned — **not** zero.

**DI lifetime — singleton.** Registered as a singleton by
`Tracon.Voice`. Call this interface; Tracon supplies the implementation, so
do not implement or replace it.

**Tenant behavior — TENANT-INDEPENDENT.** Pricing is
configured process-wide, not per tenant; no member here takes a tenant
parameter.

## Properties

### <a id="Tracon_IVoicePricingReader_Currency"></a> Currency

The currency label shown in reports.

```csharp
string? Currency { get; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

## Methods

### <a id="Tracon_IVoicePricingReader_ForCharacters_System_Decimal_"></a> ForCharacters\(decimal\)

Computes a character-based generation's cost for the default synthesizer.

```csharp
decimal? ForCharacters(decimal characters)
```

#### Parameters

`characters` [decimal](https://learn.microsoft.com/dotnet/api/system.decimal)

The billed character count.

#### Returns

 [decimal](https://learn.microsoft.com/dotnet/api/system.decimal)?

The amount; [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) if pricing is undefined.

#### Remarks

Uses the default synthesizer's provider name and configured model. A call
that knows which provider and model produced the audio uses
[IVoicePricingReader.ForSynthesis](/api/tracon.ivoicepricingreader/#Tracon_IVoicePricingReader_ForSynthesis_System_String_System_String_System_Decimal_) instead.

### <a id="Tracon_IVoicePricingReader_ForSynthesis_System_String_System_String_System_Decimal_"></a> ForSynthesis\(string, string?, decimal\)

Computes the cost of a synthesis by the provider and model that produced it.

```csharp
decimal? ForSynthesis(string providerName, string? modelId, decimal characters)
```

#### Parameters

`providerName` [string](https://learn.microsoft.com/dotnet/api/system.string)

The [ISpeechSynthesizer.ProviderName](/api/tracon.ispeechsynthesizer/#Tracon_ISpeechSynthesizer_ProviderName) of the synthesizer.

`modelId` [string](https://learn.microsoft.com/dotnet/api/system.string)?

The model the synthesizer reported ([SpeechAudio.ModelId](/api/tracon.speechaudio/#Tracon_SpeechAudio_ModelId)), or the
one the request named; [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when neither is known.

`characters` [decimal](https://learn.microsoft.com/dotnet/api/system.decimal)

The billed character count.

#### Returns

 [decimal](https://learn.microsoft.com/dotnet/api/system.decimal)?

The amount; [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) if pricing is undefined.

#### Remarks

The default implementation returns [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

### <a id="Tracon_IVoicePricingReader_ForTranscription_System_String_System_String_System_TimeSpan_"></a> ForTranscription\(string, string?, TimeSpan\)

Computes the cost of a transcription by the provider and model that produced it.

```csharp
decimal? ForTranscription(string providerName, string? modelId, TimeSpan duration)
```

#### Parameters

`providerName` [string](https://learn.microsoft.com/dotnet/api/system.string)

The [ISpeechTranscriber.ProviderName](/api/tracon.ispeechtranscriber/#Tracon_ISpeechTranscriber_ProviderName) of the transcriber.

`modelId` [string](https://learn.microsoft.com/dotnet/api/system.string)?

The model the transcriber reported ([SpeechTranscript.ModelId](/api/tracon.speechtranscript/#Tracon_SpeechTranscript_ModelId)), or
the one the request named; [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when neither is known.

`duration` [TimeSpan](https://learn.microsoft.com/dotnet/api/system.timespan)

The duration of the transcribed audio.

#### Returns

 [decimal](https://learn.microsoft.com/dotnet/api/system.decimal)?

The amount; [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) if pricing is undefined.

#### Remarks

The default implementation returns [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).
