Skip to content

PAI 3.0 Electron installer fails voice setup due to API key permissions issue #667

@vpzed

Description

@vpzed

When running the PAI 3.0 Electron installer and providing an ElevenLabs API key, which works and has been fine for previous PAI versions, the installer returns "Key validation failed: HTTP 401. Skipping voice setup."

When I perform a curl using the code from PAI-Install/engine/detect.ts

curl -H 'xi-api-key:sk_...' https://api.elevenlabs.io/v1/user it returns

{"detail":{"status":"missing_permissions","message":"The API key you used is missing the permission user_read to execute this operation."}}

But again I was getting voice notifications just fine in PAI 2.5 so the key is valid. If you give an invalid key it gives a different error of

{"detail":{"status":"invalid_api_key","message":"Invalid API key"}}

The installer continues with voice selection and even when choosing the "Sounds great" option because the test did play the notification, the ElevenLabs API key is not written to ~/.config/PAI/.env Since the sound played I thought it would write the key based on the installer flow continuing.

Both return HTTP 401 though tripping the return { valid: false, error: HTTP ${res.status} }; in detect.ts (block shown below):

/**
 * Validate an ElevenLabs API key.
 */
export async function validateElevenLabsKey(key: string): Promise<{ valid: boolean; error?: string }> {
  try {
    const res = await fetch("https://api.elevenlabs.io/v1/user", {
      headers: { "xi-api-key": key },
      signal: AbortSignal.timeout(10000),
    });

    if (res.ok) return { valid: true };
    return { valid: false, error: `HTTP ${res.status}` };
  } catch (e: any) {
    return { valid: false, error: e.message || "Network error" };
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions