Skip to content

feat(realtime): add generation_tick event support - #27

Merged
AdirAmsalem merged 1 commit into
mainfrom
feat/realtime-generation-tick
Feb 12, 2026
Merged

AdirAmsalem merged 1 commit into
mainfrom
feat/realtime-generation-tick

Conversation

@AdirAmsalem

Copy link
Copy Markdown
Contributor

Summary

  • Add generation_tick event support to surface periodic billing updates (total billed seconds) during authenticated realtime sessions
  • generation_ended is parsed but intentionally not exposed — unreliable on client disconnect, overlaps with connection_change, and insufficient_credits is already covered by the error event
  • Mirrors the implementation already shipped in the TypeScript SDK (feat(realtime): add generationTick event for billing updates sdk#81)

Usage

def on_tick(data):
    print(f"Billed so far: {data.seconds}s")

client.on("generation_tick", on_tick)

Changes

  • messages.py — GenerationTickMessage and GenerationEndedMessage Pydantic models, added to IncomingMessage discriminated union
  • webrtc_connection.py — on_generation_tick callback, handles both events in _handle_message()
  • webrtc_manager.py — on_generation_tick added to WebRTCConfiguration, wired through _create_connection()
  • client.py — Callback list, emit/dispatch, buffer flush, on()/off() support for "generation_tick"
  • init.py — Export GenerationTickMessage for user type hints

Surface periodic billing updates (total billed seconds) during
authenticated realtime sessions. generation_ended is parsed but
intentionally not exposed publicly.
@AdirAmsalem AdirAmsalem changed the title feat(realtime): add generation_tick billing event support feat(realtime): add generation_tick event support Feb 12, 2026
@AdirAmsalem
AdirAmsalem merged commit 2d9a23d into main Feb 12, 2026
8 checks passed
@AdirAmsalem
AdirAmsalem deleted the feat/realtime-generation-tick branch February 12, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant