Code from an AI
AI wrote my code, now how do I run it? DeepSeek, ChatGPT and others
In short
Code from an AI chat is run like any other code: put all the files in one folder, add a dependency list, move tokens out of the code into secrets, and publish the project on a host. It does not matter whether DeepSeek, ChatGPT, Alice or GigaChat wrote it: most of the time the code fails for the same reasons — an invented or outdated package, localhost instead of 0.0.0.0, or a token typed straight into the code. On Netrun you can check the folder for free before signing up, then upload it as an archive and get a link; a bot on the free plan runs for 3 hours, a website for as long as you like.
- A package that does not exist on PyPI or npm will not install: pip answers No matching distribution found, and npm returns 404 Not Found.
- Code that calls openai.ChatCompletion.create was written for openai library versions below 1.0 and does not work in version 1.0 or newer.
- An aiogram 2 bot started with executor.start_polling does not run on aiogram 3, because that way of starting was removed in version 3.
- A server listening on localhost or 127.0.0.1 cannot be reached from outside on a host: it has to listen on 0.0.0.0 and the port from the PORT variable.
- A token typed straight into the code travels with the archive or repository to anyone who gets them, which is why tokens belong in environment variables.
You told DeepSeek, ChatGPT, Alice or GigaChat what kind of bot or website you need and got code back. Then comes the confusing part: where to put that code so it works not just on your computer, but through a link and without your laptop switched on. AI chats are happy to explain servers and setup, but they rarely write code that is ready to run on a host as is.
The good news: code from different AI models fails in almost the same ways, and each of those problems takes minutes to fix. Below is the path from a chat answer to a working link, plus a list of what to check before publishing. For a general guide covering any AI tool, see how to publish AI-generated code.
| What is wrong | What you see | How to fix it |
|---|---|---|
| No dependency list | ModuleNotFoundError or Cannot find module on start | Ask the AI for a requirements.txt or package.json covering every import |
| An invented package | No matching distribution found or 404 during install | Check the name on pypi.org or npmjs.com and drop what does not exist |
| Code for an old library version | AttributeError, ImportError, a message that something is no longer supported | Pin the version in the dependency list or ask for code for the current one |
| localhost instead of 0.0.0.0 | Opens on your computer, not via the link | Listen on 0.0.0.0 and the port from the PORT variable |
| A token inside the code | Anyone with the code can see the token | Move it into secrets and read it from an environment variable |
| Database and files next to the code | Data disappears after an update | Keep the database and uploads in the /data folder |
| Code pieced together from several answers | SyntaxError, duplicate functions, missing files | Ask for the whole project, file by file, with a folder tree |
Put all the files in one folder#
Create a project folder and lay out the code exactly as the AI suggested, each file under its own name. If the code came in pieces across several answers, ask the AI to give you the whole project file by file and show the folder tree. The main file should have an obvious name such as main.py, bot.py, app.py or index.js. Remove spare copies and old versions of files so you do not have to guess which one is real.
Ask the AI for a dependency list#
Without a dependency list the server does not know which libraries to install, and the project fails with ModuleNotFoundError. Ask the AI to write a requirements.txt with versions for Python, or a package.json for Node.js. Then check every name on pypi.org or npmjs.com: AI models sometimes invent packages that do not exist, and installation fails with No matching distribution found. Pin the versions explicitly so that a new, incompatible release does not get installed a month later.
Make sure the code matches current library versions#
AI models learned from older code and often write for past library versions. Typical examples: openai.ChatCompletion.create does not work in the openai library from version 1.0, and starting a bot with executor.start_polling was removed in aiogram 3. If the logs show AttributeError or ImportError, paste the error into the chat and ask for code that fits the current version. The other route is to pin the old version the code was written for in the dependency list.
Move tokens out of the code into secrets#
AI models like to put the token right in the code, in a line such as BOT_TOKEN = "123:ABC". That way the token travels with the archive or repository and anyone can read it. Ask the AI to read the token from an environment variable, for example os.environ["BOT_TOKEN"] in Python or process.env.BOT_TOKEN in Node.js. Then enter the value itself in the Secrets tab on Netrun, where it is stored encrypted, and you can import a .env file from your code there too.
Fix the server address and the place for data#
If the project has a website or an API, the server must listen on 0.0.0.0 and the port from the PORT variable, not on localhost, otherwise it opens on your computer but not through the link. A bot that connects to Telegram on its own does not need a port at all. Put an SQLite database and uploaded files in the /data folder, because anything outside it is gone after the next publish. You can ask the AI for both fixes in one sentence.
Check the project and upload it#
Before publishing, run the folder through the free Netrun check: it works without signing up and shows what the platform understood about the project and what is missing. Then publish the project as an archive, a folder, from GitHub, or straight from an AI editor if you write code in Cursor or a similar tool. If something fails, open the logs in your dashboard, copy the full error text and send it to the same AI: with the real error it fixes code far more accurately than from a description.
Code from an AI chat is ordinary code, just a little more likely to have outdated libraries, a token in plain text and a localhost address. Go through the list above and most projects start on the first or second try, while the rest is fixed by asking the same AI with the error text from the logs. On Netrun a website on the free plan runs for as long as you like, a bot runs for 3 hours so you can see it reply, and a bot that runs around the clock needs the Pro plan. You can check your folder without signing up. Try Netrun.
Common questions
Can I run code from ChatGPT if I am not a programmer?
Yes. You need to put the files in a folder, ask the AI for a dependency list and move tokens into secrets, and all of that is done by asking the same AI. Then the folder goes to a host that detects the language and starts the project on its own. If something fails, the error text from the logs goes back into the chat.
Why did the code work on my computer but crash on the server?
Most often the libraries were already installed on your computer but are missing from the dependency list. The second common reason is a localhost address: the page opens on your machine, but the server cannot be reached from outside. The third is file paths like C:\Users that do not exist on a server. All three take minutes to fix.
What if the AI suggests a package that does not exist?
Check the name on pypi.org for Python or npmjs.com for Node.js. If the package is not there, tell the AI it was not found and ask it to replace it with a real library. Do not install similarly named packages from unknown authors at random.
Should I ask the AI to write a Dockerfile?
Usually not. Netrun detects the language on its own, including Python, Node.js, Go, PHP and others, and builds the project without a Dockerfile. A Dockerfile of your own is for special cases, for example when the project needs a browser for Selenium or Playwright. If the AI already wrote one, you can keep it, and the platform will build the project from it.
Is it safe to paste my bot token into an AI chat?
Better not: a token is the key to your bot and has no business being in a chat. Ask the AI for code that reads the token from an environment variable, and enter the value only in your host settings. If the token has already ended up in a chat or in the code, issue a new one in BotFather and the old one stops working.
Which languages and technologies are supported?
Python, Node.js, Go, Rust, Ruby, PHP, Java, .NET, Deno, Bun, Elixir, static sites and bash scripts. You can bring your own Dockerfile or docker-compose, but more often the stack is detected from your code automatically.
Where do I set tokens and other secret values?
Every project has a Secrets tab where you set the values from your code — for example the token from BotFather. We store them encrypted: you can see the variable names, but the values are shown to no one, including you.
Is my data kept when I update the code?
Yes, as long as your data lives in persistent storage. For a regular project that is the /data folder: anything your app saves there stays in place when you update the code or restart, and you can browse and download the files on the "Data" tab. If you described the services yourself in docker-compose, persistent storage means the named volumes from your file, and such a project has no /data folder. Files written outside persistent storage are created from scratch on the next deploy. Your project link stays the same either way.