Rajandran R Creator of OpenAlgo Sketchmaker, RagZ. Building GenAI Applications. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Now the recent curiosity on building Trading AI Agents.

Use Google Gemini Pro as your AI Coding Assistant in Visual Studio Code Editor

4 min read

To use Gemini Pro as a coding assistant in VS Code, you need three things: a Gemini API key from Google AI Studio, a VS Code extension that can talk to the Gemini API (this guide uses CodeGPT), and the right model selected in that extension. Once configured, you type prompts in a chat panel inside the editor and Gemini writes, explains or fixes code for you.

The Google Gemini Pro API, with its release in December 2023, marked a significant advancement in the field of AI for developers. It’s designed to assist in various aspects of coding and development, making it a valuable tool for those looking to integrate advanced AI capabilities into their applications.

Google AI Studio and Google Cloud Vertex AI are platforms provided by Google to access and utilize the Gemini Pro API

OpenAlgo: one API for 35+ Indian brokers

FREE AND OPEN SOURCE

OpenAlgo: one API for 35+ Indian brokers

Self-hosted algo trading platform. Send orders from Python, AmiBroker, TradingView, Excel or a no-code flow through one consistent API.

  • Unified REST and WebSocket API
  • Works with AmiBroker, TradingView, ChartInk and Excel
  • Sandbox mode to test before going live
Get OpenAlgo →by Marketcalls
Key takeaways
  • Get a free Gemini API key from Google AI Studio (the old makersuite link now redirects to aistudio.google.com).
  • Install the CodeGPT extension in VS Code and choose Google AI Studio as the provider.
  • The original gemini-pro model name from 2024 is retired; pick a current model from Google’s model list.
  • Google also offers its own Gemini Code Assist extension if you prefer an official plugin.
  • Never paste broker API keys or passwords into prompts.

Steps to Set Up Gemini Pro Coding Assistant in VS Code

To obtain a Google Gemini Pro API key, you need to follow a series of steps that begin with registering for API access on Google’s developer platform. Here is the general outline of the process, followed by a 2026 update on model names.

Step 1: Install Visual Studio Code

If you haven’t already, download and install Visual Studio Code (VS Code)

Step 2: Obtain a Google Gemini API Key

  • Visit the Google AI website, typically at ai.google.dev.
  • Click on Get API key in Google AI Studio
  • Goto the Google AI Studio and click on Get API Key and generate a new API key for the Gemini API. This may involve creating a project and enabling the Gemini API for that project.
  • Once generated, copy the API key for later use.

The Get API Key link above now redirects to aistudio.google.com/app/apikey. The Gemini API has a free tier with rate limits, and paid tiers for higher limits (Gemini API pricing).

Step 3: Install the Code GPT Extension in VS Code

  • Open VS Code.
  • Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or by pressing Ctrl+Shift+X.
  • In the Extensions view, search for “Code GPT” which supports Google Gemini and various other LLM models like OpenAI, Mistral,Anthropic etc.
  • Find the correct extension (it might be named something like “Code GPT:Chat & AI Agents”) and click on the ‘Install’ button.

Step 4: Configure the Code GPT Extension to Access the Gemini API

Open the Chat Box from the Left sidebar and Configure the Provider as Google AI Studio and Model as gemini-pro

Once the Configuration is done it will be asking for Gemini API Key. If not goto the Set Connection as shown below and Enter the copied Gemini API Key.

Step 5: Start Prompting

Use the Chat Box to Access the Coding Prompts and Get your prompts converted into Code.

Keep your VS Code and the extension updated to ensure compatibility and access to the latest features.

You can also use the CodeGPT Extension to Fix the bug/ troubleshoot your code, prepare documentation and even as a code explainer. Basically Gemini Pro API will be acting as your coding assistance along with you in increasing your coding productivity. This makes it an essential tool for anyone looking to harness the power of AI in coding and application development. For video walkthroughs, see the marketcalls YouTube channel.

2026 Update: Gemini Model Names Have Changed

When I wrote this in January 2024, the model to select was gemini-pro, which was Gemini 1.0 Pro. That model ID no longer works. Google now ships new Gemini versions every few months, and its models page lists stable and preview IDs such as gemini-3.1-pro-preview and gemini-3.8-flash (November 2026). Even gemini-2.5-pro, released in June 2025, has a listed shutdown date of 1 December 2026 (Gemini deprecations).

  • If CodeGPT shows an error after selecting a model, open the model dropdown again and pick a model that appears in the current list.
  • Use a Pro model for multi-file reasoning and debugging, and a Flash model for quick completions and lower cost.
  • Check the deprecations page once in a while; preview models can be shut down at short notice.

CodeGPT vs Gemini Code Assist

CodeGPT is a third-party extension that supports many providers (Gemini, OpenAI, Anthropic, Mistral and others) using your own API key. Google also has an official extension, Gemini Code Assist, available in Standard and Enterprise editions through Google Cloud and in a consumer version for individuals (Gemini Code Assist overview).

CodeGPT + Gemini API keyGemini Code Assist
PublisherThird partyGoogle
ModelsGemini plus other providersGemini only
BillingYour Gemini API key (free tier or paid)Google account or Google Cloud subscription
Best forSwitching between LLMs in one panelStaying fully in the Google stack

Gemini Pro Coding Assistant Prompts for Traders

Here are prompts I use when building trading tools in Python with an AI coding assistant:

  • “Write a Python function that resamples 1-minute OHLCV data in a pandas DataFrame to 15-minute candles, aligned to 09:15 IST.”
  • “Explain this backtest code line by line and point out any look-ahead bias.”
  • “Add error handling and retry logic around this broker API call, without changing the order parameters.”
  • “Convert this AmiBroker AFL moving average crossover to a Python vectorbt backtest.”

For setting up the Python side, see how to install VectorBT in a virtual environment and use it in VS Code. If you want to try other models inside VS Code, read algo trading development with AWS Bedrock and the Cline extension, and for prompting tips that apply to any LLM, see how experienced traders should prompt Claude to build strategies.

Common Mistakes

  • Using a retired model ID. Old tutorials (including the screenshots above) show gemini-pro. Use a current ID.
  • Committing the API key to Git. Keep keys in environment variables or a .env file listed in .gitignore.
  • Running generated trading code live without testing. Paper trade or backtest first; LLM code can look correct and still mis-handle sessions, holidays or order types.
  • Pasting sensitive data. Do not paste broker credentials, access tokens or client data into the chat.

Frequently Asked Questions

Is the Gemini API key free?

Yes, Google AI Studio gives a free tier with rate limits. Higher limits and some top models need a paid tier.

Can I use Gemini in VS Code for free?

Yes. You can use a free Gemini API key with an extension such as CodeGPT, or use the consumer version of Google’s Gemini Code Assist.

Why does gemini-pro give an error in CodeGPT?

The gemini-pro (Gemini 1.0 Pro) model is retired. Select a current model from the dropdown, for example a Gemini 3.x Pro or Flash model.

Gemini Code Assist vs Claude Code: which is better for trading code?

Both can write Python trading code well. Choose based on the model you prefer and how you work: Gemini Code Assist lives in the editor, while Claude Code is agent-style and works from the terminal or IDE.

Next step: once your Gemini Pro coding assistant is working in VS Code, see how to build a Google Gemini digital assistant Slack bot using the same API key.

Python Elite membership

MEMBERSHIP

Python Elite membership

15 Python, AI and algo trading programs in one plan, including QuantFlow and AI Bootcamp live mentorship.

  • Python from fundamentals to trading apps
  • Backtesting, broker APIs and OpenAlgo
  • Live QuantFlow and AI Bootcamp sessions
View Python Elite →by Marketcalls

Learn by watching: free videos every week

Market Profile, order flow, Python, AI and OpenAlgo tutorials on YouTube.

Rajandran R Creator of OpenAlgo Sketchmaker, RagZ. Building GenAI Applications. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Now the recent curiosity on building Trading AI Agents.

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More