Skip to content

Improve Sesame voice chat compatibility with current web flow and auth bootstrap - #9

Open
SaseQ wants to merge 1 commit into
ijub:mainfrom
SaseQ:main
Open

Improve Sesame voice chat compatibility with current web flow and auth bootstrap#9
SaseQ wants to merge 1 commit into
ijub:mainfrom
SaseQ:main

Conversation

@SaseQ

@SaseQ SaseQ commented Mar 9, 2026

Copy link
Copy Markdown

Summary

This PR updates the client to match current Sesame web behavior and fixes connection failures seen with the old flow.

What changed

  • Updated WebSocket defaults to align with web app handshake:
    • client_name default is now Consumer-Web-App
    • Origin default is now https://app.sesame.com
  • Added connection diagnostics in WebSocket layer:
    • captures and exposes server-side error messages (last_error)
    • unblocks connect wait on explicit error/close paths
  • Fixed call setup payload:
    • call_connect now sends settings={"character": <character>} by default
    • optional preset support kept via settings={"preset": <preset>} when provided
  • Added backend user bootstrap API call:
    • SesameAI.ensure_external_user(...) calls PUT /api/external/user
    • invoked during voice chat authentication so fresh anonymous tokens can be used without manual setup
  • Extended token handling utilities:
    • TokenManager.set_tokens(...)
    • TokenManager.load_firebase_auth_user(...)
    • get_valid_token(..., allow_anonymous=True)
  • Improved CLI auth options in examples/voice_chat.py:
    • --id-token
    • --refresh-token
    • --firebase-auth-json
    • --no-anonymous
    • --client-name
  • Updated README to document the new auth/connect behavior and options.

Why

Sesame backend behavior changed compared to the original wrapper assumptions. The old flow caused failures such as:

  • 403 Access denied. Anonymous users not allowed
  • 5002 Settings were not found
  • 404 No user found

This PR aligns the Python client with the currently working web flow and restores a smooth "just run the example" experience.

Scope

Modified files:

  • sesame_ai/websocket.py
  • sesame_ai/api.py
  • sesame_ai/token_manager.py
  • examples/voice_chat.py
  • README.md

@matt-norris

Copy link
Copy Markdown

looks like this projects been abandoned but nice work

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.

2 participants