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:

You got me :grinning_face_with_smiling_eyes:’ed for the last one!

I’ve got your back, sir.

My Actions & Next Steps

I’ve carefully reviewed all your comments, categorized them into feedback, bugs, and feature requests, and forwarded them to the appropriate teams.

I’m sharing this to assure you that you’re in safe hands and that actions are underway in the backend.

To help the team investigate further, I’ve sent you a DM — please share the email ID associated with your AI Studio account.

In the meantime, I highly encourage you to keep building, exploring, and pushing the system to its limits (or even breaking it!) — and share your feedback with us. We truly value insights like yours. :slightly_smiling_face:

Well, I got the bill today, so you’re definitely taking my money. :wink:
And yes, I keep building more apps with it. I have various domain names and just need some basic content for each of them. An interesting example would be ‘Moderated by moderator’ which is just a framework app for my future projects. It displays the basic needs for them, which is a settings button where I can enter an API key and select a Gemini or Imagen model. Plus a TOS button. An About button showing the whole team and three companies behind the site (demo, btw.) and a button to change between light and dark mode. Then a basic division in a header and footer, left and right sidebar and a main area. Just a basic design pattern.
At ‘Moderated by moderator’ is a simple example of an App I created that does more than this framework. It allows visitors to create complete C# projects from scratch using their own API key and Gemini. It works surprisingly well and the generated code even compiles and sometimes even executes correctly. It’s a good way to save some time for simple projects. It stores everything in local storage, although I have build other apps that do connect to a backend.
My domain ‘Moderated by moderator’ is something with a backend, as it is used to generate RSA keys and allows me to test encryption/decryption and signing/validating with them. I needed a C# backend for this as the JavaScript generation of RSA keys is too slow and a bit faulty.
So I like AI studio as it allows me to make interesting web apps in just hours, or days, instead of weeks. I like the fact that it handles the frontend requirements as my speciality is more backend code.
But as I said, AI Studio tends to modify code in ways that I never asked for. For example, by reducing the Gemini models in the list to just Flash. But I also like to include an instructions.txt file in my AI Studio projects to specify clear instructions to the AI, yet sometimes it rewrites the instructions, while it should not even touch them! I’ve also seen it completely redesign the UI of an app when I just asked to add one more field.
As I said, it seems to want to do more than I asked for. :slight_smile:

Hi @Katje,

I have few questions regarding ‘server_code’ folder issue:

Can you elaborate on exactly what part of the code is missing.

The intention is to understand whether the code being filtered is being flagged as malicious for some reason.

We have added new data to the models to generate code with the new uSDKs.. Please check.

1 Like

In AI Studio I can create my own folders and move files into it. The project that uses ‘server_code’ has changed too much by now, as I removed that folder as I didn’t need it any more. ((I now have a ‘templates’ folder with text-versions of the server code. But the screenshots at the bottom will show examples of my custom folders.
I managed to restore things easily, though. (Backups matter! :smiley: )

The first screenshot shows a ‘data’ folder with information about fictional ‘employees’. Each employee is basically a single AI engine and I have nine of them, so my app can technically do nine Gemini or Imagen requests at the same time. This is used by me in chatbots where the app is focused on a specific topic and the multiple engines tend to help me to tell when the AI is hallucinating as they will contradict one another. AI Studio uses this information internally to make various AI prompts for each employee. This JSON data should not be modified, but sometimes AI Studio ‘thinks’ it needs to be better structured or that parts of the JSON is obsolete, so it makes changes to it or even delete parts. (And on one occasion, it deleted all the content so I had empty JSON files.)

The second screenshot is where I had the original problem, and sometimes I still do. There’s also an ‘instructions’ folder above it. But the folders ate now ‘public/templates’ and ‘public/instructions’ so AI Studio is more reliable at keeping the content intact because it’s in ‘public’.
This code is for an app that explains a project related to JWT/JWKS in C#, where AI Studio basically has to make adjustments to the code also. These templates are combined with various options in the App to generate a project with certain specific properties, which can be downloaded as a ZIP file. The purpose of this app is to allow the user to download the code, build it, make adjustments and then use the App for some basic testing by calling the REST Api of the project the user has just built.
But before, in the ‘server_code’ I would have similar C# code as text files with the server just deleting the content for unknown reasons.
Keep in mind that these files can be changed in AI Studio, even by the AI. It just should not remove them by cleaning the content, unless I asked for that.


The code getting filtered out are text files containing C# templates.