How to Set Up Your Skaya AI API Key (Gemini) 🔑 ​
To unlock Skaya's powerful AI-powered code generation features, you need to configure a Gemini API key. This guide will walk you through the entire process, from obtaining your key to configuring it correctly in your development environment.
In the future, we will introduce dedicated Skaya API keys, but for now, integration is seamless with Google's Gemini API.
1. Obtaining Your API Key ​
First, you need to get a Gemini API key. You can create one for free from either of these Google platforms:
- Google AI Studio (Recommended for quick setup)
- Google Cloud Console (For more advanced control and restrictions)
2. Configuring Your API Key ​
Once you have your key, you need to let Skaya know what it is. You can do this in two ways.
Option A: Environment Variable (Recommended) ​
Using an environment variable is the most secure method. It keeps your key out of your source code, which is essential for security, especially in production or CI/CD environments.
Set the SKAYA_API_KEY
variable in your shell's configuration file (e.g., ~/.bashrc
, ~/.zshrc
for Linux/macOS, or via System Properties in Windows).
For Linux/macOS:
export SKAYA_API_KEY="your_gemini_api_key_here"
**For Window CMD: After adding the variable, remember to reload your shell configuration (e.g., source ~/.bashrc or open a new terminal window).
- Local .npmrc File You can also store the API key in a .npmrc file at the root of your Skaya project. This is convenient for individual projects but less secure than environment variables if the file is committed to a public repository.
Execute the following command in your project's root directory:
echo 'skaya_api_key=your_gemini_api_key_here' >> .npmrc
Best Practices ​
Never commit your API keys to version control (e.g., Git repositories), especially public ones. Use .gitignore to exclude .npmrc files if they contain sensitive information and rely on environment variables for deployment.
Restrict API Key Usage: If using the Google Cloud Console, apply API restrictions (e.g., by HTTP referrer or IP address) to your API key to limit its exposure.
Rotate Keys: Regularly rotate your API keys to minimize the impact of a potential compromise.
By properly configuring your API key, you can seamlessly integrate Skaya's AI capabilities into your development workflow.