Authentication
Chucky uses JWT (JSON Web Tokens) for authentication. Tokens are created server-side with your HMAC secret and include budget limits for each user.Token Architecture
1
Request Token
Your client (browser) requests a token from your backend server
2
Create JWT
Your server creates a JWT signed with your HMAC secret, including user ID and budget limits
3
Return Token
Server returns the signed JWT to the client
4
Use SDK
Client uses the token to connect to Chucky Cloud via the SDK
Creating Tokens
Basic Token
Get your Project ID and HMAC Secret from your project settings at app.chucky.cloud.The Project ID and HMAC Secret are separate values found in your project settings at app.chucky.cloud.
The Project ID is used in JWT tokens, while the HMAC Secret is used for signing (never exposed in tokens).
Token Options
Budget Configuration
Budgets control how much each user can spend. Two types of limits:- AI Budget: Cost limit for Claude API calls (in dollars)
- Compute Budget: Time limit for sandbox execution (in hours)
Budget Helper
Budget Windows
Raw Budget Format
If you need more control, you can specify the raw budget format:AI budget is specified in microdollars (1 USD = 1,000,000 microdollars) for precision.
Token Permissions
Restrict what users can do with their token:Permission Options
SDK Config Overrides
Override client-side SDK options from the token (server-enforced):SDK config overrides take precedence over any options passed by the client.
Token Utilities
Decode Token (No Verification)
Verify Token
Check Expiration
Token Payload Structure
The JWT payload contains:Best Practices
Short-lived tokens
Short-lived tokens
Use short expiration times (1 hour or less) and refresh tokens as needed. This limits exposure if a token is compromised.
Per-session tokens
Per-session tokens
Create a new token for each user session rather than reusing tokens. This provides better audit trails and security.
Conservative budgets
Conservative budgets
Start with small budgets and increase based on user needs. You can always create a new token with a larger budget.
Use permissions
Use permissions
Restrict tools and models based on user trust level. Free users might get limited tools, while premium users get full access.