[null,null,["最后更新时间 (UTC):2025-07-31。"],[],[],null,["# Add your own Gemini API key\n\n| **Note:** The ability to add your own API key is only applicable if you're using Gemini's free tier; business users have access to Gemini 2.5 Pro by default.\n\nThe default Agent mode in Android Studio has a no-cost daily quota with a\nlimited context window. To expand the context window, you can add your own\nGemini API key to take advantage of up to 1 million tokens with Gemini 2.5 Pro. \n\nA larger context window lets you send more instructions, code, and attachments\nto Gemini, leading to even higher quality responses. This is especially useful\nwhen working with agents because the larger context provides Gemini 2.5 Pro with\nthe ability to reason about complex or long-running tasks.\n\nTo get an API key:\n\n1. Sign in to [Google AI Studio](https://aistudio.google.com/) and get a key by clicking on the Get API key button.\n2. In Android Studio, go to **File (Android Studio** on macOS) **\\\u003e Settings \\\u003e\n Tools \\\u003e Gemini** to enter your Gemini API key.\n3. Relaunch Gemini in Android Studio and get even better responses from Agent mode.\n\nBe sure to safeguard your Gemini API key because\n[additional charges](https://ai.google.dev/gemini-api/docs/pricing) apply for\nGemini API usage associated with a personal API key. You can monitor your Gemini\nAPI key usage in AI Studio through **Get API Key \\\u003e Usage \\& Billing**."]]