Skip to content

Conversation

@rrnewton
Copy link

@rrnewton rrnewton commented Dec 3, 2025

Summary

Extends the /v1/voice/token endpoint to accept optional custom ElevenLabs credentials from the client, enabling bring-your-own voice agent support.

Changes

  • Custom Credentials Support: Added optional customAgentId and customApiKey parameters to the voice token request
  • Credential Selection: Server uses client-provided credentials when present, otherwise falls back to server defaults (ELEVENLABS_API_KEY and ELEVENLABS_AGENT_ID env vars)
  • Improved Error Handling: Parse and return detailed error messages from ElevenLabs API responses instead of generic failures

API Changes

POST /v1/voice/token

Request body (all fields optional):

  {
    "revenueCatPublicKey": "string",
    "customAgentId": "string",
    "customApiKey": "string"
  }

When customAgentId and customApiKey are both provided, the server uses these credentials to fetch the conversation token from ElevenLabs. Otherwise, it uses the server's configured defaults.

Backward Compatibility

Fully backward compatible - existing clients that don't send custom credentials continue to work with server defaults.

Test plan

  • Request token without custom credentials - uses server defaults
  • Request token with custom credentials - uses provided credentials
  • Request with invalid custom API key - returns detailed ElevenLabs error
  • Request with invalid custom agent ID - returns appropriate error

Note: The client and server PRs should be merged together or in sequence (server first, then client) since the client changes depend on the server supporting custom credentials.
Client PR: slopus/happy#258

rrnewton and others added 2 commits December 2, 2025 15:31
- Parse ElevenLabs API error responses to surface actual error messages
- Helps debug issues like missing API key permissions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Accept optional customAgentId and customApiKey in request body
- Use user-provided credentials when available, fallback to server env vars
- Enables per-user ElevenLabs agent configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@rrnewton
Copy link
Author

rrnewton commented Dec 3, 2025

(Update: ran some limited PR tests via the happy-devbox repo that simulates a monorepo linking the commits in these PRs together.)

E2E Tests

This PR includes working E2E tests using Playwright:

  • Create Account flow: Tests loading the webapp, creating an account, and verifying logged-in state
  • Error handling: Verifies no critical errors during normal operation

CI validation runs ./scripts/validate.sh which includes:

  • TypeScript builds for happy-cli, happy-server, and webapp
  • Unit tests for happy-cli and happy-server
  • E2E tests with browser automation

Green CI Run: https://github.com/rrnewton/happy-devbox/actions/runs/19894554194/job/57021496616

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