Gemini Realtime API error: 1007 None. The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model

1. Error

Hi, I had reported this exact same error a while back (Kindly view here)and since then it was working temporarily

2. Context

  • My observations remain same that I am still not able to figure out when and due to what this error occurs but recently tokay(from past 6 hours) I have been rigorously testing my application and it occurred in 95% of the sessions(mainly within 1-3 message exchanges)! I’m kinda burnt out, lol
  • The only model I am using is → REALTIME_MODEL = “gemini-2.5-flash-native-audio-preview-12-2025”
  • My application allows both TEXT and real time AUDIO input/conversation using Gemini Live Api and LiveKit

3. My pyproject.toml

requires-python = ">=3.10,<3.14"
dependencies = [
    "livekit-agents[google]~=1.5",
    "google-genai>=1.30.0",
    "python-dotenv>=1.0.0",
    "flask>=3.1.3",
    "livekit-api>=1.1.0",
    "flask-cors>=6.0.2",
    "llama-index-vector-stores-qdrant>=0.10.1",
    "qdrant-client>=1.18.0",
    "fastembed>=0.8.0",
]
  • NOTE: I am no more using qdrant or fastembed. My application consists of only one agent.py file

4. Here is my entrypoint/session code

server = AgentServer()

@server.rtc_session(agent_name="agent-xyz")
async def entrypoint(ctx: agents.JobContext):
    await ctx.connect()
    
    participant = await ctx.wait_for_participant()
    web_identity = participant.identity

    logger.info(f"Frontend participant connected: {web_identity}")

    session = AgentSession(
        llm=google.realtime.RealtimeModel(
            model=REALTIME_MODEL,
            voice="Puck",
        ),
    )

    agent = MyAgentClass(room=ctx.room, web_identity=web_identity, agent_session=session)
    # logger.info(f"Model: {REALTIME_MODEL}")
    logger.info("Starting AUDIO native session")

    # agent.start(ctx.room, participant)
    await session.start(
        room=ctx.room,
        agent=agent,
    )

    # try:
    #     await session.generate_reply(
    #         instructions="Greet the user"
    #     )
    # except Exception as exc:
    #     logger.warning("Initial greeting failed: %s", exc)

if __name__ == "__main__":
    agents.cli.run_app(server)

5. Error I see in LiveKit’s session’s logs

1 session —

2 session —

3 session —

4 session —

Thank you in advance

One thing worth ruling out before you keep digging: this isn’t audio leaking into the chat context. _provider_format/google.py drops AudioContent outright (elif isinstance(content, llm.AudioContent): pass), so the re-seeded turns are text-only by construction. Worth knowing, since that’s the obvious suspect for an audio-content-type error and it’s a dead end.

The question that would split this cleanly: does the 1007 land immediately after a connecting to Gemini Realtime API… line, or mid-stream during a turn?
The plugin re-seeds the whole chat context via send_client_content on every connect (realtime_api.py ~L947), so a failure at that point is a completely different path from one on live audio input. Your screenshots show the error but not what precedes it that one line above it decides which half to look at.

If it is the re-seed, #5985 is worth reading. Different model and different message, but the same mechanism: the re-seed is redundant since session_resumption is always sent and the server restores context anyway, and it turns a routine reconnect into a 1007 loop.

Also worth confirming your actual installed version ~=1.5 allows anything in 1.x, so pip show livekit-agents livekit-plugins-google would tell us whether you’re on 1.7.0 or still back where #5985 was filed.

I’m also wondering exactly how to reproduce this? That error is coming from the model

  1. I have been testing it for the past few days now and the 1007 error lands in the first 3-4 messages provided we make the agent execute a tool call in those initial 3-4 agent messages/turns. this is all through Voice input.
  2. Why I say the error is mysterious is because the error in the above scenario lands 50% percent of the time and rest of the time it works
  3. one more thing I forgot to mention, when the 1007 error lands I am then not able to use ‘voice input’(it does not transcribes) but when I send input via ‘text’ it follows up with this error “ignoring text stream with topic ‘lk.chat’, no callback attached”, this happens everytime after the 1007 error

Here are some session’s logs I recently tested:

session 1—

session 2—

session 3—

session 4—

session 5—

example of when this error occurs:
user: hi there
agent: hi how can I help you today ?
user: can you send this(xyz) for me please
agent: Yes I → 1007 Error. Agent does not finish their sentence due to error.

NOTE:

  1. if I keep repeating the above scenario at one point it keeps working and then back to throwing error like a cycle
  2. and if I keep chatting with it without making it execute any tool calls in the first 1-7/8 user messages/turns and then make it execute any tool call it works, there is no 1007 error in this scenario!

sometimes I do receive the ‘connecting to gemini realtime api’ if the conversation is stretching a little too long and then the agent stops replying for 10-15 seconds but reconnects successfully every single time, therefore that message is not an issue.

The SS I provided in this message shows the full context.

I looked into the 5985 issue and I did not understand much of it due to my lack of knowledge on internal working of livekit but I do know that the 1007 error mentioned here is not the exact one I am recieving and my session does not die after ~10min too as mentioned above

Here is what my terminal shows:

backendPy> pip show livekit-agents livekit-plugins-google
WARNING: Package(s) not found: livekit-agents, livekit-plugins-google

backendPy>uv pip show livekit-agents livekit-plugins-google
Name: livekit-agents
Version: 1.6.6
Location: backendPy\.venv\Lib\site-packages
Requires: aiofiles, aiohttp, av, certifi, click, colorama, docstring-parser, eval-type-backport, json-repair, livekit, livekit-api, livekit-blingfire, livekit-local-inference, livekit-protocol, nest-asyncio, numpy, openai, opentelemetry-api, opentelemetry-exporter-otlp, opentelemetry-sdk, prometheus-client, protobuf, psutil, pydantic, pyjwt, pyyaml, sounddevice, typer, types-protobuf, typing-extensions, watchfiles
Required-by: gemini-hacker-starter, livekit-plugins-google
---
Name: livekit-plugins-google
Version: 1.6.6
s-protobuf, typing-extensions, watchfiles
Required-by: gemini-hacker-starter, livekit-plugins-google
---
Name: livekit-plugins-google
Version: 1.6.6
Location: backendPy\.venv\Lib\site-packages
Requires: google-auth, google-cloud-speech, google-cloud-texttospeech, google-genai, livekit-agents
Required-by:

are these versions okay ?

  • one more point for extra context, My access token or join token endpoint is deployed as a Supabase edge function in US region. My frontend is deployed on Vercel in US region( yes I receive the same error logs when testing on localhost like uv run python agent.py dev). My agent is deployed in US too on LK Cloud.

Please let me know if you require more details in order to fix this issue, I would like to finish this error once and for all. Thanks.

@Keshav_Pachpinde The single most useful thing here: that “context exhausted” line is not a diagnosis, it’s a mislabel. From the plugin source:

  if getattr(e, "code", None) == 1007 or "1007" in str(e):
      logger.error(
          "Gemini Live closed the session: context exhausted (1007). "
          "Reconnecting would replay the same context and fail again; "
          "terminating the session.")
      self._emit_error(e, recoverable=False)
      raise APIConnectionError(message="Gemini Live session context exhausted (1007)")

realtime_api.py, added in #6144. It matches on the bare close code, so every 1007 gets relabelled “context exhausted” and marked non-recoverable. Your actual error is Gemini’s CONTENT_TYPE_AUDIO is not supported for this model configuration, which is a config rejection and has nothing to do with context size.

That explains three things you flagged: why #5985 didn’t fit, why your session doesn’t die at ~10 minutes, and why it terminates instead of retrying. It also means the “Reconnecting would replay the same context” claim in your logs is not what happened.

I checked whether the replayed context after a tool call could be carrying audio, since that would fit the tool-call trigger. It can’t: the Google formatter drops audio explicitly (elif isinstance(content, llm.AudioContent): pass in _provider_format/google.py). So that path is ruled out.

Two things that would isolate it:

  1. Log the frame sent immediately before the close: set livekit.plugins.google and google_genai.live to DEBUG. Your 50% rate and the tool-call trigger mean the payload will differ between a passing and a failing run.
  2. Run the same tool-call-in-first-3-turns test against a non-native-audio live model. If the 1007 disappears, it is specific to the native audio preview, which has several open issues.

Versions are fine, both 1.6.6 and consistent. pip show failing while uv pip show works is just the uv-managed venv. The lk.chat message is downstream of the session already being closed, not a second bug. Worth dropping the TurnDetector while you debug, since it warns in every one of your sessions.

I’m also getting this error when I use Gemini Realtime model gemini-2.5-flash-native-audio-preview-12-2025

Here is the error I get

livekit.agents._exceptions.APIConnectionError: Gemini Live session context exhausted (1007) (caused by APIError: 1007 None. The audio content type (CONTENT_TYPE_AUDIO) is not supported for this model configuration.)

@Peace Have you managed to fix this? Or are you still facing it.