# Speechmatics (/en/ai/models/asr/speechmatics)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

Speechmatics provides real-time automatic speech recognition (ASR) with flexible language support and reliable performance for conversational AI applications.

### Sample configuration [#sample-configuration]

The following example shows how to configure Speechmatics ASR when starting a conversational AI agent.

<Tabs defaultValue="python" groupId="ai-sdk-language">
  <TabsList>
    <TabsTrigger value="python">
      Python SDK
    </TabsTrigger>

    <TabsTrigger value="typescript">
      TypeScript SDK
    </TabsTrigger>

    <TabsTrigger value="go">
      Go SDK
    </TabsTrigger>

    <TabsTrigger value="rest-api">
      REST API
    </TabsTrigger>
  </TabsList>

  <TabsContent value="python">
    ```python
    from agora_agent import Agent, SpeechmaticsSTT

    # client is your configured Agora client
    agent = (
        Agent(client)
        .with_stt(SpeechmaticsSTT(
            api_key='your-speechmatics-key',
            language='en',
            uri='wss://eu2.rt.speechmatics.com/v2',
        ))
        .with_llm(...)  # configure your LLM vendor
        .with_tts(...)  # configure your TTS vendor
    )
    ```
  </TabsContent>

  <TabsContent value="typescript">
    ```typescript
    import { Agent, SpeechmaticsSTT } from 'agora-agents';

    // client is your configured Agora client
    const agent = new Agent({ client })
      .withStt(new SpeechmaticsSTT({
        apiKey: 'your-speechmatics-key',
        language: 'en',
        uri: 'wss://eu2.rt.speechmatics.com/v2',
      }))
      .withLlm(/* configure your LLM vendor */)
      .withTts(/* configure your TTS vendor */);
    ```
  </TabsContent>

  <TabsContent value="go">
    ```go
    import "github.com/AgoraIO/agora-agents-go/v2/agentkit/vendors"

    // client is your configured Agora client
    agent := agentkit.NewAgent(client).WithStt(
        vendors.NewSpeechmaticsSTT(vendors.SpeechmaticsSTTOptions{
            APIKey:   "your-speechmatics-key",
            Language: "en",
            URI:      "wss://eu2.rt.speechmatics.com/v2",
        }),
    ).WithLlm(/* configure your LLM vendor */).
      WithTts(/* configure your TTS vendor */)
    ```
  </TabsContent>

  <TabsContent value="rest-api">
    Use the following `asr` configuration in your request:

    ```json
    "asr": {
      "vendor": "speechmatics",
      "language": "en-US",
      "params": {
        "key": "<speechmatics_key>",
        "language": "en",
        "uri": "wss://eu2.rt.speechmatics.com/v2"
      }
    }
    ```
  </TabsContent>
</Tabs>

<CalloutContainer type="warning">
  <CalloutTitle>
    Caution
  </CalloutTitle>

  <CalloutDescription>
    The parameters listed on this page are validated for use with Conversational AI Engine. Required parameters must be provided as documented. Any additional parameters are passed through directly to the underlying vendor without validation. For a full list of supported options, refer to the [Speechmatics documentation](https://docs.speechmatics.com/api-ref/realtime-transcription-websocket).
  </CalloutDescription>
</CalloutContainer>

### Key parameters [#key-parameters]

<ParameterList title="params" required="true">
  <Parameter name="key" type="string" required="true">
    The Speechmatics API key used to authenticate requests. You must provide a valid key for the service to function.
  </Parameter>

  <Parameter name="language" type="string" required="true">
    The language code to use for transcription. For example, use `en` for English.
  </Parameter>

  <Parameter name="uri" type="string" required="false">
    The WebSocket URL for the Speechmatics streaming API. Specify this to target a particular region. For example, `wss://eu2.rt.speechmatics.com/v2`.
  </Parameter>
</ParameterList>
