[Note: this post has been translated with my own translator] [Note: using the API has costs; the cost of use depends on the size of the documents. As a rough guide during development, tests and various translations of 2-page documents I spent 0.0.3€ over 5 days]
In this post I present a small project I’ve published as open source. What would once have been a project of many years and several million euros is now a small experiment done on a Saturday morning. The keys are GitHub Copilot, ChatGPT 4 as programming assistants, and the GPT-3.5 Turbo API.

gpt-translator#
You can download it from https://github.com/granludo/gpt-test/tree/main/file-trasnlator
Licensed under the GNU General Public License v3.0
Simple Python 3 program that uses OpenAI’s GPT-3.5-turbo model to translate files from one language to another. It splits the file into 20-line chunks.## Requirements
You need an API key to use OpenAI’s API; you can get one here: https://beta.openai.com/docs/developer-quickstart/api-key this program looks for the key in a file indicated by the “mykeypath” variable, by default at the path ‘..//..//mykey.json’
You need to have Python 3 installed on your system. I used Python 3.10
You need to install the json and openai packages
pip install openai
pip install json
On your system you might need to use pip3 instead of pip.
Usage#
python3 gpt-traductor.py fitxer_origen idioma_origen idioma_destí fitxer_destí
Example
python3 gpt-translate.py sample.md català italià sample_translated.md
Have fun.
