AI Studio is doing more than I asked for

In my project I had created a folder ‘server_code’ which contained some source files from my server Web API as text files. But sometimes AI Studio tries to delete them by removing the contents of each file. That’s really bad behavior.
I also ask AI Studio to generate an app that calls my Web API and provided it the REST OpenAI specifications as JSON. It should just call it directly, yet it has tried to use a third-party proxy instead to call my API. As the app is handling some sensitive information, I don’t want these calls to go through a third party!
I also told the app to add a dialog box to ask for an API key and add a dropdown box so I can select a Gemini model. My app is making calls to Gemini, but I want users to provide their own keys. (It’s not sent to my server.) Yet the sandbox version in AI Studio seems to ignore this key, and AI Studio also likes to reduce all mu Gemini models to just the 2.5 Flash version.
And regularly, when I ask it to fix or add a specific feature, it tends to be distracted and do some other stuff also without fixing what was asked first. Or worse, tell me how it’s going to fix it without adding the fix to the code.
These are just things that annoy me. It slows me down a bit when I have to restore checkpoints… Which reminds me: please set checkpoints before the code is changed, not afterwards!

@Katje ,

This seems to be the case when you use “Build app” in AIstudio. We have brought this up with the internal gemini team,

I believe this is not the case when you geenrate code either in AI studio chat or Gemini-Cli. I would suggest you use this approach of generating that specific part of the code using either chat in the ai studio or Gemini-cli if you preffer doing this in an IDE

1 Like

Well, I like to use “Build App” as I’m focused on developing various Web APIs in C# and just need a quick front-end to test them. When the frontend works, other team members will start with what “Build App” has generated as an example, as I’m not really an expert there. (Okay, I understand more than enough to make it work.)
At the moment, I have Visual Studio optimized to build the Web API in C# and send it to my web server. The Web API has my main focus and uses OpenAPI as the standard. AI Studio just has to read these specifications and generate code for it using the “Build app”. But as I said, it gets annoying when “Build App” is doing more than I ask for or when it tries to reroute all API calls through a third-party service.
My app is also using Gemini to generate valid-looking data for my API, like real names for people and products. Which makes it annoying when “Build app” is trying to change these instructions or just removes them.

Ok,

Let’s address your issues one by one @Katje

1. File Deletion in “server_code” Folder
Can you be specific on what actions in your workflow triggered wiping out contents.. Please elaborate on this and I will try to reproduce on my end.

2. Unwanted Proxies for API Calls
If your OpenAI spec points to a direct endpoint, AI Studio should not introduce a third-party proxy unless explicitly instructed. I’ll flag this behavior so our team

To ensure direct calls, as a temporary fix, can you remove or override proxy logic in the generated code or add a clear directive such as:

Do not use any proxy service. Always call the Web API directly.

This instruction in your project prompt can reinforce this instruction.

3. User-Provided API Keys Being Ignored
The sandbox’s tendency to ignore runtime-provided keys (especially for Gemini) is a known limitation. Sandbox environments use project-level credentials by default for security reasons.

I’ll attach your feedback directly to that internal discussion to help them consider your feature request for future sandbox upgrades.

4. Unintended behavior
To improve control use more direct prompts like:

“Fix only the API call logic; do not touch any other part of the code.”
“Create this feature, validate with me and perform code change.”

Explicitly providing prompts like these can help manage its behavior.

4. Coding Checkpoints
I will raise this to the concerned team as well.

Thanks for sharing your feedback and observations @Katje.. Keep exploring and keep sharing your experience.. Our team is constantly learning from feedbacks like yours and use them to improve our products..

So thanks again for posting :slight_smile:

  1. File Deletion in “server_code” Folder
    I had several .txt files in it containing C# code that I used as reference. AI Studio cannot delete files, but it can modify the content, including removing all content. Which is what it tries to do. But I did not ask the AI to clean up things so this is a bad action.

2. Unwanted Proxies for API Calls
This happened just with one project of mine. It tried to use codetabs com as a proxy for my API. I’m not sure why it tried that.
It also has some challenges understanding the OpenAI standard, as I have methods that require form data as parameters, yet it tries to pass them through the URL or just as plain body. And tends to ignore the field names. A few nudges helps to correct this, but it should not need any nudges.

Do not use any proxy service. Always call the Web API directly.
Yep. Used that after discovering that it tried to use a proxy. But it doesn’t always remember these instructions. It would be nice if AI Studio would remember the instructions I gave him, and keeps this instruction list updated when I change things.

3. User-Provided API Keys Being Ignored

That explains a lot! And it is a bit annoying. :slight_smile: Thing is, I want the browser to memorize the API key of the user inside the browser only. It will never be passed to the server or added to any logging. This allows other users to use my app, but with their own API key. (Thus, keeping my own usage low.) I don’t want other users to use my key, which is why I’m not using the environment to store it. The user must provide one.

4. Unintended behavior
The “do not touch any other part of the code.” should be standard. If I want the AI to refactor it, I will ask.

4. Coding Checkpoints
This is practical because after refreshing the chat and providing a new prompt, it first changes the code and then sets a checkpoint. Which is basically the code after the changes. Who came up with that? :smiley:

Keep exploring and keep sharing your experience.
I definitely will. Right now, I’m just working on a few hobby projects plus three work projects. For example, I created rsa katje biz which is a simple tool to manage RSA keys within the browser. It uses a Web API on my server to generate these keys as this isn’t working fast enough in the browser. It also shows a typical layout of the apps I try to create, with lots of logging in a console window. Changing the colors and dark/light mode switch are also interesting, although AI Studio has challenges setting the correct colors. (For example, I tend to get black fonts on black backgrounds.)
Another fun project was qr foxboom nl which can either read QR codes through the webcam or generate QR codes to read with my mobile. Very simple setup without the need of a backend, yet practical.
So yes, AI Studio is a very useful tool for me. :slight_smile:

Btw. This does cause some limitations for me as I tend to hit against quotas while using AI Studio to build an app. I get an “Failed to run code assistant, quota exceeded: you have reached the daily limit of requests for this model. Please select a different model, or try again tomorrow.” which is annoying as I can’t switch the model, nor even control this quota. I have a paid account with a reasonably large quota so it’s really annoying when I hit some limit every day that I have no control over. Take my money, and allow me to have more requests! :smiley: