Skip to content

feat: add --inference flag to token create command to create bearer tokens usable in the inference gateway#773

Merged
shawnfeldman merged 3 commits into
mainfrom
shawnfeldman/add-bearer-token
Mar 2, 2026
Merged

feat: add --inference flag to token create command to create bearer tokens usable in the inference gateway#773
shawnfeldman merged 3 commits into
mainfrom
shawnfeldman/add-bearer-token

Conversation

@shawnfeldman

@shawnfeldman shawnfeldman commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds --inference flag to lk token create that sets an InferenceGrant{Perform: true} on the generated JWT
  • Adds "Inference" option to the interactive permission multi-select prompt

Example

$ lk token create --inference --identity inference_e2e --valid-for 60m
Using generated room name [room-12314]
valid for (mins):  60
Token grants:
{
  "room": "room-12314"
}

Access token:....

Decoded JWT payload confirms the inference grant:

{
  "identity": "inference_...",
  "inference": {
    "perform": true
  },
  "name": "inference_..",
  "video": {
    "room": "room-12314"
  }
}

Test plan

  • lk token create --inference --identity inference_e2e --valid-for 60m generates a valid JWT with inference grant
  • lk token create interactive prompt shows "Inference" as a selectable permission
  • Existing token creation flows (join, create, admin, etc.) are unaffected
  • go test ./... passes

🤖 Generated with Claude Code

Adds support for generating access tokens with InferenceGrant,
matching the token generation logic used in agent-gateway for
AI/inference endpoint authentication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Feb 27, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@shawnfeldman shawnfeldman changed the title feat: add --inference flag to token create command feat: add --inference flag to token create command to create bearer tokens usable in the inference gateway Feb 27, 2026

@rektdeckard rektdeckard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! If you want to bump the version as well, I can kick off a release for this.

Comment thread cmd/lk/token.go Outdated
Comment on lines 431 to 432

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably print the whole ClaimGrants struct, not just the VideoGrant.

shawnfeldman and others added 2 commits March 2, 2026 08:22
Addresses review feedback to show all grant types (inference, identity,
etc.) in the "Token grants:" output, not just the video grant.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shawnfeldman

Copy link
Copy Markdown
Contributor Author

Bumped to 2.14.0 and pushed. Minor version bump since this adds a new feature (--inference flag). Ready for release.

@shawnfeldman

Copy link
Copy Markdown
Contributor Author

@rektdeckard ready to go

 ./lk token create --inference --identity inference_e2e --valid-for 60m --api-key "$LIVEKIT_API_KEY" --api-secret "$LIVEKIT_API_SECRET" 2>&1
> Using generated room name [room-{#}]
Using url, api-key, api-secret from environment
valid for (mins):  60
Token grants:
{
  "identity": "inference_e2e",
  "name": "inference_e2e",
  "video": {
    "room": "room-{#}"
  },
  "inference": {
    "perform": true
  }
}

Project URL: {url}
Access token: {token}

@shawnfeldman shawnfeldman merged commit 43c8e51 into main Mar 2, 2026
9 checks passed
@shawnfeldman shawnfeldman deleted the shawnfeldman/add-bearer-token branch March 2, 2026 15:32
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.

4 participants