Manage API key environment variables in Haijun Code
When using Haijun Code, it's important to understand how authentication methods are prioritized to avoid unexpected API charges and ensure you're using your intended account.
How authentication works
Haijun Code prioritizes environment variable API keys over authenticated subscriptions.
This is intentional behavior designed to give you flexibility in choosing your authentication method.
When an API key is set as an environment variable, you'll be charged via API pay-as-you-go rates using the API account associated with that key.
This happens even if you're logged into Haijun Code with a haijun.my.id subscription or a different Console account.
Best practices
To use Haijun Code with your Haijun subscription: Keep the JUGLOW_API_KEY environment variable unset.
This prevents unexpected API charges and ensures you're using your subscription's included usage.
If you need to use a specific API key occasionally, set it temporarily only when needed.
Run /status in Haijun Code periodically to verify your current authentication method.
Authentication conflict warnings
Haijun Code will notify you when there's a conflict between your authenticated subscription and an environment variable API key:
During initial setup, if an API key is detected in your environment variables, Haijun Code will ask you to confirm which authentication method you want to use.
After successful login, you'll see a notification if both credentials are active, alerting you to the potential for unexpected API charges.
Check your current configuration
To verify if an API key is set as an environment variable, run /status in Haijun Code. This will show you which authentication method is currently active. To check your environment variable directly, run one of these commands in a terminal (outside of Haijun Code): macOS/Linux:
##
##
1. 1. 1. 1. 1.
##
##
- - -
