Fresh LiveKit Cloud project and API keys. Both Agent Worker startup and RoomService/ListRooms API calls return 401 Unauthorized. Using livekit-agents 1.6.2, livekit-api 1.1.0, Python 3.13. Looking for guidance on authentication or project configuration re

livekit-agents 1.6.2
livekit-api 1.1.0

RoomService/ListRooms returns 401.
Worker registration returns 401.

Project URL:

https://mykare-ai-t6teebjb.livekit.cloud

Using freshly generated API keys.

Hi Joel, a 401 would imply you have not granted enough permissions to the tokens you are providing to participants.

What is it you’re trying to do exactly?

Thanks for the response.

I’m actually not at the participant connection stage yet.

I’m trying to register a LiveKit Agents worker using:

  • livekit-agents 1.6.2

  • livekit-api 1.1.0

  • Python 3.13

The worker fails before entrypoint() is reached.

Minimal worker:

cli.run_app(
    WorkerOptions(
        entrypoint_fnc=entrypoint
    )
)

When running:

python main.py start

I get:

failed to connect to livekit
401 Unauthorized
wss://<project>.livekit.cloud/agent

I also tested LiveKitAPI().room.list_rooms() and it returns 401.

JWT token generation using AccessToken(...).to_jwt() succeeds with the same API key and secret.

Am I missing a specific configuration or credential requirement for agent worker registration in LiveKit Cloud?


I see, it feels like your LiveKit API keys are improperly set in your project .env file

Did you run through this quickstart guide, it should set these values automatically based on the lk CLI:

I think I may have found a different issue.

When I run:

lk cloud auth

it asks for a device name, then shows:

Device [V]
Requesting verification token...

Please confirm access by visiting:

https://cloud.livekit.io/cli/confirm-auth?t=<token>

A browser window opens, but before I can even select a project or approve access, the terminal prints:

session expired

and the auth flow terminates.

This happens before authentication completes.

Is this expected behavior, or could there be an issue with the CLI, system clock, or token expiration?

I’m on:

  • Windows

  • livekit-agents 1.6.2

  • LiveKit CLI installed via winget

It could be your system clock, if it’s running fast.

Another possibility is you need to upgrade your version of the CLI, but I assume you are running the latest

There is a -t parameter you can pass, i.e. lk cloud auth -t 300 but when I test that with 1 I get a different error after a second, session claim timed out. I think maybe double-check your clock first.