Skip to content

gemini-2.5-flash-native-audio Live API: Transcription Fails with "Invalid Argument" (1007) or No Messages in Node.js SDK (@google/genai@^1.34.0`) #1212

Closed

Description

@zohairraza

Product/Service: Vertex AI Gemini Live API

SDK: Node.js (@google/genai)

SDK Version: ^1.34.0 (as reported by package.json)

Model: gemini-2.5-flash-native-audio-preview-09-2025

Operating System: Linux


Description:

I am attempting to establish a real-time speech-to-speech session with transcription using the
gemini-2.5-flash-native-audio-preview-09-2025 model via the @google/genai Node.js SDK. The primary issue is the
inability to receive either inputAudioTranscription or outputAudioTranscription messages, or to even stabilize a
connection when configuring the API as per documentation.

There appear to be two related problems:

  1. Connection Failure with Modality.TEXT in responseModalities:
    When Modality.TEXT is included in the responseModalities configuration (as indicated by documentation for enabling
    transcriptions), the WebSocket connection immediately terminates with Code: 1007 Reason: Request contains an invalid
    argument..

  2. Missing Transcription Messages (Even with Transcription Flags Enabled):
    When Modality.TEXT is removed from responseModalities (to achieve a stable connection) but
    input_audio_transcription: true and output_audio_transcription: true are enabled, the connection is stable and audio
    streams successfully. However, no message.inputAudioTranscription or message.outputAudioTranscription objects are ever
    received in the onmessage callback. This prevents any transcription from being obtained.

This behavior contradicts the official documentation (e.g., GEMINI.md in our project, and conceptual code examples
online) which suggests including TEXT in responseModalities is necessary for transcription. This issue is similar to one
reported for the Python SDK where a version update was required to fix missing transcription fields
(googleapis/python-genai#1279).


Steps to Reproduce:

  1. Initialize GoogleGenAI client with apiVersion: "v1alpha".
  2. Connect to ai.live.connect using model: 'gemini-2.5-flash-native-audio-preview-09-2025'.
  3. Configure the session with:
    • Scenario 1 (Connection Failure):

1 config = {
2 responseModalities: [Modality.AUDIO, Modality.TEXT], // As per documentation for transcription
3 input_audio_transcription: true,
4 output_audio_transcription: true,
5 // ... (other config like systemInstruction, tools)
6 };
* Scenario 2 (Missing Transcription Messages):

1 config = {
2 responseModalities: [Modality.AUDIO], // To achieve stable connection
3 input_audio_transcription: true,
4 output_audio_transcription: true,
5 // ... (other config like systemInstruction, tools)
6 };
4. Observe the WebSocket connection status and onmessage callbacks.


Expected Behavior:

  • For Scenario 1: The WebSocket connection should establish successfully, and transcription messages
    (inputAudioTranscription, outputAudioTranscription) should be received in the onmessage callback when audio input is
    provided, along with audio output.
  • For Scenario 2: The WebSocket connection should establish successfully, and transcription messages
    (inputAudioTranscription, outputAudioTranscription) should be received in the onmessage callback when audio input is
    provided, along with audio output.

Actual Behavior:

  • For Scenario 1: The WebSocket connection immediately closes with Code: 1007 Reason: Request contains an invalid
    argument..
  • For Scenario 2: The WebSocket connection establishes and audio streams successfully. However,
    message.inputAudioTranscription and message.outputAudioTranscription are never populated in the onmessage callback.

Relevant Logs/Context:

Scenario 1 (Failure with Modality.TEXT) Logs:

1 Gemini Session Config: {
2   responseModalities: [ 'AUDIO', 'TEXT' ],
3   input_audio_transcription: true,
4   output_audio_transcription: true,
5   systemInstruction: 'You are Lisa, the highly professional, warm, and hyper-efficient AI receptionist...', // (Your
  full instruction text)
6   tools: [ { functionDeclarations: [Array] } ]
7 }
8 Gemini Session Model: gemini-2.5-flash-native-audio-preview-09-2025
9 Gemini Session Opened

10 Gemini Session Closed. Code: 1007 Reason: Request contains an invalid argument.

Scenario 2 (Stable, but no transcription messages) Logs:

(These logs would contain Gemini Session Opened, setupComplete, modelTurn with audio inlineData, generationComplete, but
crucially, no inputAudioTranscription or outputAudioTranscription messages after sending user audio.)


Additional Information:

  • We've confirmed saveAudioChunk is working, writing raw pcm data from both user and AI.
  • We've confirmed Deepgram can transcribe these saved audio files post-call.
  • The issue appears to be specific to the Gemini Live API's handling of transcription with the Node.js SDK at version
    ^1.34.0.

Activity

  1. added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Dec 23, 2025
  2. self-assigned this
    on Dec 24, 2025
  3. shmishra99 commented on Dec 29, 2025

    @shmishra99
    Contributor

    @zohairraza , Based on my checks, the gemini-2.5-flash-native-audio-preview-09-2025 model does not support TEXT in the responseModalities field. You must set it to AUDIO only. Once connected, you will find the transcription inside message.serverContent.outputTranscription within the ai.live.connect callback.

    Additionally, in your example, you are using output_audio_transcription: true, but the correct way to initialize this in the SDK is outputAudioTranscription: {}. Let me know if this helps. Thank you!

  4. zohairraza commented on Jan 6, 2026

    @zohairraza
    Author

    that helped, thanks a lot @shmishra99

  5. spotinfo-ai commented on Jan 19, 2026

    @spotinfo-ai

    @shmishra99

    if we do this billing applicable will be output Audio or output Text ?

    As per google AI Studio, Text output is charged at $2, while Audio output is charged at $12. I want to use only Text output

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: livestreamIssues related to the Live Stream API API.priority: p2Moderately-important priority. Fix may not be included in next release.status:awaiting user responseissues requiring a response from the usertype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions