If you see an error message about a missing token, make sure you've added your token to the .env file.
REPLICATE_API_TOKEN=r8_YourTokenHere
Replicate API tokens must:
r8_Correct format:
REPLICATE_API_TOKEN=r8_AbCdEfGhIjKlMnOpQrStUvWxYz
Incorrect formats:
REPLICATE_API_TOKEN="r8_AbCdEfGhIjKlMnOpQrStUvWxYz" # Don't use quotes
REPLICATE_API_TOKEN= r8_AbCdEfGhIjKlMnOpQrStUvWxYz # Don't include spaces
REPLICATE_API_TOKEN=AbCdEfGhIjKlMnOpQrStUvWxYz # Must start with r8_
If your token is correctly formatted but still doesn't work, it might be expired or invalid.
You can test your token using the included test script:
npm run test-token
If the test fails, generate a new token from your Replicate account.
If you don't have one already, sign up at https://replicate.com/signin
Go to https://replicate.com/account/api-tokens
Click on "Create API token" and give it a name.
Copy the generated token (it will start with r8_).
Important: This is the only time Replicate will show you the full token, so make sure to copy it immediately.
Open the .env file in the project root and add your token:
REPLICATE_API_TOKEN=r8_YourNewTokenHere
After updating the token, restart the server:
npm start
You can verify your token is working correctly by running:
npm run test-token
If successful, you should see a message confirming your token is valid.