# SpeechRequest

> 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.speechrequest/
> Summary: SpeechRequest: A text-to-speech generation request.

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

A text-to-speech generation request.

```csharp
public sealed record SpeechRequest : IEquatable<SpeechRequest>
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.speechrequest/">SpeechRequest</a></dd><dt>Implements</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.iequatable-1">IEquatable&lt;SpeechRequest&gt;</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Constructors

### <a id="Tracon_SpeechRequest__ctor"></a> SpeechRequest\(\)

```csharp
public SpeechRequest()
```

## Properties

### <a id="Tracon_SpeechRequest_Credential"></a> Credential

The tenant's own credential for the provider, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to use
the credential the synthesizer was configured with.

```csharp
public ModelProviderCredential? Credential { get; init; }
```

#### Property Value

 [ModelProviderCredential](/api/tracon.modelprovidercredential/)?

#### Remarks

Tracon sets it from the tenant's provider binding for
[ISpeechSynthesizer.ProviderName](/api/tracon.ispeechsynthesizer/#Tracon_ISpeechSynthesizer_ProviderName), and only for a synthesizer whose
[ISpeechSynthesizer.SupportsTenantCredentials](/api/tracon.ispeechsynthesizer/#Tracon_ISpeechSynthesizer_SupportsTenantCredentials) is
[true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). It lives in memory for the call and is never persisted;
its text form never shows the key.

### <a id="Tracon_SpeechRequest_IncludeTimestamps"></a> IncludeTimestamps

Requests character-level timing alongside the audio. Default [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool).

```csharp
public bool IncludeTimestamps { get; init; }
```

#### Property Value

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

#### Remarks

Not supported together with [ISpeechSynthesizer.SynthesizeStreamingAsync](/api/tracon.ispeechsynthesizer/#Tracon_ISpeechSynthesizer_SynthesizeStreamingAsync_Tracon_SpeechRequest_System_Threading_CancellationToken_):
that method returns raw audio chunks only and has no channel for alignment
data. A synthesizer implementation MUST reject the combination explicitly
rather than silently drop the alignment.

### <a id="Tracon_SpeechRequest_LanguageCode"></a> LanguageCode

The language's ISO 639-1 code. The provider detects it itself if empty.

```csharp
public string? LanguageCode { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_SpeechRequest_ModelId"></a> ModelId

The synthesis model to use. When empty, the synthesizer uses its own default
(the built-in client: `VoiceOptions.SynthesisModelId`).

```csharp
public string? ModelId { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_SpeechRequest_OutputFormat"></a> OutputFormat

The provider's output format name (for example, `mp3_44100_128`).

```csharp
public string? OutputFormat { get; init; }
```

#### Property Value

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

This is **not** a MIME type. Also, not every format can
be stored as an attachment: `pcm_*` and `ulaw_*` outputs are
headerless, match no file signature, and are rejected by the attachment
type check.

### <a id="Tracon_SpeechRequest_ProviderSettings"></a> ProviderSettings

Gets the provider-specific settings, keyed under the provider's prefix (for example
`elevenlabs.stability`). Empty by default.

```csharp
public IReadOnlyDictionary<string, JsonElement> ProviderSettings { get; init; }
```

#### Property Value

 [IReadOnlyDictionary](https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlydictionary\-2)<[string](https://learn.microsoft.com/dotnet/api/system.string), [JsonElement](https://learn.microsoft.com/dotnet/api/system.text.json.jsonelement)\>

#### Remarks

A synthesizer refuses an unknown key, another provider's key and a value of the
wrong type before it calls the service; it never ignores one. The message names the
key, never the value. A synthesizer that supports no setting refuses every key
([ModelProviderSettings.Validate](/api/tracon.modelprovidersettings/)
with an empty list). One exception: a synthesizer that serves a Microsoft.Extensions.AI client
through `AddSpeechSynthesizer(name, binding)` hands the keys to the client unchanged, because
Tracon cannot tell which keys the client reads.

Code sets it; the `speak` tool and `POST /api/voice/speak` send none.

### <a id="Tracon_SpeechRequest_Text"></a> Text

The text to speak.

```csharp
public required string Text { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="Tracon_SpeechRequest_VoiceId"></a> VoiceId

The identifier of the voice to use. `VoiceOptions.DefaultVoiceId` if empty.

```csharp
public string? VoiceId { get; init; }
```

#### Property Value

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

### <a id="Tracon_SpeechRequest_Equals_System_Object_"></a> Equals\(object?\)

```csharp
public override bool Equals(object? obj)
```

#### Parameters

`obj` [object](https://learn.microsoft.com/dotnet/api/system.object)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_SpeechRequest_Equals_Tracon_SpeechRequest_"></a> Equals\(SpeechRequest?\)

```csharp
public bool Equals(SpeechRequest? other)
```

#### Parameters

`other` [SpeechRequest](/api/tracon.speechrequest/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_SpeechRequest_GetHashCode"></a> GetHashCode\(\)

```csharp
public override int GetHashCode()
```

#### Returns

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="Tracon_SpeechRequest_ToString"></a> ToString\(\)

```csharp
public override string ToString()
```

#### Returns

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

### <a id="Tracon_SpeechRequest_op_Equality_Tracon_SpeechRequest_Tracon_SpeechRequest_"></a> operator ==\(SpeechRequest?, SpeechRequest?\)

```csharp
public static bool operator ==(SpeechRequest? left, SpeechRequest? right)
```

#### Parameters

`left` [SpeechRequest](/api/tracon.speechrequest/)?

`right` [SpeechRequest](/api/tracon.speechrequest/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### <a id="Tracon_SpeechRequest_op_Inequality_Tracon_SpeechRequest_Tracon_SpeechRequest_"></a> operator \!=\(SpeechRequest?, SpeechRequest?\)

```csharp
public static bool operator !=(SpeechRequest? left, SpeechRequest? right)
```

#### Parameters

`left` [SpeechRequest](/api/tracon.speechrequest/)?

`right` [SpeechRequest](/api/tracon.speechrequest/)?

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)
