deepgram-java-conversational-stt

作者: deepgram

Use when writing or reviewing Java code in this repo that calls Deepgram Conversational STT v2 / Flux over `/v2/listen`. Covers…

npx skills add https://github.com/deepgram/deepgram-java-sdk --skill deepgram-java-conversational-stt

Using Deepgram Conversational STT / Flux (Java SDK)

Turn-aware streaming transcription over /v2/listen for conversational audio.

When to use this product

  • You want explicit turn events, not just regular interim/final transcript chunks.
  • You are building conversational UX where end-of-turn timing matters.

Use a different skill when:

  • You need general-purpose STT over REST or classic streaming → deepgram-java-speech-to-text.
  • You need a hosted interactive assistant → deepgram-java-voice-agent.

Authentication

import com.deepgram.DeepgramClient;

DeepgramClient client = DeepgramClient.builder()
        .apiKey(System.getenv("DEEPGRAM_API_KEY"))
        .build();

Quick start

import com.deepgram.resources.listen.v2.types.ListenV2CloseStream;
import com.deepgram.resources.listen.v2.types.ListenV2CloseStreamType;
import com.deepgram.resources.listen.v2.websocket.V2ConnectOptions;
import com.deepgram.resources.listen.v2.websocket.V2WebSocketClient;
import java.util.concurrent.TimeUnit;

V2WebSocketClient wsClient = client.listen().v2().v2WebSocket();

wsClient.onConnected(connected ->
        System.out.println("request_id=" + connected.getRequestId()));

wsClient.onTurnInfo(turnInfo -> {
    System.out.printf("[%s] turn=%.0f transcript=\"%s\"%n",
            turnInfo.getEvent(),
            turnInfo.getTurnIndex(),
            turnInfo.getTranscript());
});

wsClient.connect(V2ConnectOptions.builder()
        .model("flux-general-en")
        .build())
        .get(10, TimeUnit.SECONDS);

// wsClient.sendMedia(okio.ByteString.of(audioChunk));

wsClient.sendCloseStream(ListenV2CloseStream.builder()
        .type(ListenV2CloseStreamType.CLOSE_STREAM)
        .build());

Key parameters / API surface

  • Entry point: client.listen().v2().v2WebSocket()
  • Required connect field: model(String)
  • Verified connect options in source: encoding, sampleRate, eagerEotThreshold, eotThreshold, eotTimeoutMs, keyterm, mipOptOut, tag
  • Send methods: sendMedia(...), sendCloseStream(...)
  • Event handlers: onConnected(Consumer<ListenV2Connected>), onTurnInfo(...), onErrorMessage(...), plus generic connection/error hooks

API reference (layered)

  1. In-repo source of truth: src/main/java/com/deepgram/resources/listen/v2/ and examples/listen/LiveStreamingV2.java. No reference.md exists in this checkout.
  2. Canonical AsyncAPI: https://developers.deepgram.com/asyncapi.yaml
  3. Context7: /llmstxt/developers_deepgram_llms_txt
  4. Product docs:

Gotchas

  1. This is WebSocket-only in the Java SDK. There is no REST helper for /v2/listen here.
  2. model is a plain String, not an enum. Use Flux model IDs such as flux-general-en exactly.
  3. Close with sendCloseStream(...), not Listen V1 finalize. The message type is different from v1.
  4. The current Java connect options do not expose language_hint. Do not assume the Python surface exists here.
  5. Turn events are the main payload. Handle onTurnInfo(...), not Listen V1 onResults(...).
  6. You still need to stream binary audio manually. The example only wires handlers and close flow.
  7. Wait for connect(...).get(...) before sending media. The client is async but not fire-and-forget.

Example files in this repo

  • examples/listen/LiveStreamingV2.java

Central product skills

For cross-language Deepgram product knowledge — the consolidated API reference, documentation finder, focused runnable recipes, third-party integration examples, and MCP setup — install the central skills:

npx skills add deepgram/skills

This SDK ships language-idiomatic code skills; deepgram/skills ships cross-language product knowledge (see api, docs, recipes, examples, starters, setup-mcp).

来自 deepgram 的更多技能

deepclaw-voice
deepgram
使用Deepgram Voice Agent API设置对OpenClaw的电话呼叫
official
deepgram-js-audio-intelligence
deepgram
在编写或审查此仓库中调用 Deepgram 音频
official
deepgram-dotnet-audio-intelligence
deepgram
Use when writing or reviewing C# code in this repo that enables Deepgram intelligence overlays on Speech-to-Text requests. Covers `PreRecordedSchema` analytics…
official
deepgram-dotnet-management-api
deepgram
Use when writing or reviewing C# code in this repo that calls Deepgram Management APIs for projects, models, keys, members, invitations, usage, balances, and…
official
deepgram-dotnet-text-intelligence
deepgram
Use when writing or reviewing C# code in this repo that calls Deepgram Text Intelligence / Read (`/read`) for sentiment, summarization, topic detection, and…
official
deepgram-dotnet-text-to-speech
deepgram
Use when writing or reviewing C# code in this repo that calls Deepgram Text-to-Speech. Covers `ClientFactory.CreateSpeakRESTClient()` with `ToStream` /…
official
deepgram-dotnet-voice-agent
deepgram
在编写或审查此仓库中用于构建基于WebSocket的交互式Deepgram Voice Agent的C#代码时使用。涵盖……
official
deepgram-go-audio-intelligence
deepgram
在编写或审查此仓库中的Go代码时使用,这些代码涉及摘要(summaries)、主题(topics)、意图(intents)、情感(sentiment)、语言检测(language detection)、说话人分离(diarization)、文本编辑(redaction)或实体(entity)…
official