Skip to content

feat(client-tokens): support ephemeral keys v2#102

Merged
AdirAmsalem merged 1 commit intomainfrom
ephemeral-keys-v2
Mar 22, 2026
Merged

feat(client-tokens): support ephemeral keys v2#102
AdirAmsalem merged 1 commit intomainfrom
ephemeral-keys-v2

Conversation

@AdirAmsalem
Copy link
Copy Markdown
Contributor

@AdirAmsalem AdirAmsalem commented Mar 22, 2026

Summary

  • Add expiresIn, allowedModels, and constraints options to CreateTokenOptions for controlling token expiry, model access, and operational limits
  • Add permissions and constraints fields to CreateTokenResponse
  • Type allowedModels using (Model | (string & {}))[] for autocomplete with flexibility for unknown models
  • Simplify request body construction to forward the full options object instead of only metadata
  • Add 6 unit tests covering the new request/response fields

Usage

const token = await client.tokens.create({
  expiresIn: 300,
  allowedModels: ["lucy-pro-t2v", "lucy-pro-i2v"],
  constraints: { realtime: { maxSessionDuration: 120 } },
});

// token.apiKey         → "ek_..."
// token.expiresAt      → "2024-12-15T12:15:00Z"
// token.permissions    → { models: ["lucy-pro-t2v", "lucy-pro-i2v"] }
// token.constraints    → { realtime: { maxSessionDuration: 120 } }

Test plan

  • All 145 unit tests pass (npm test)

🤖 Generated with Claude Code

Add `expiresIn`, `allowedModels`, and `constraints` options to token
creation. Return `permissions` and `constraints` in the response.
Forward the full options object instead of only metadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 22, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@decartai/sdk@102

commit: f620f23

@AdirAmsalem AdirAmsalem changed the title feat(tokens): support ephemeral keys v2 feat(client-tokens): support ephemeral keys v2 Mar 22, 2026
@AdirAmsalem AdirAmsalem merged commit 970fc6c into main Mar 22, 2026
5 checks passed
@AdirAmsalem AdirAmsalem deleted the ephemeral-keys-v2 branch March 22, 2026 12:42
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.

1 participant