
To use GPT models in your code, you need an API Key.
Instead of using ChatGPT through the website,
the OpenAI API lets you bring GPT directly into your own code.
With it, you can do things like π
The API Key acts as the βkeyβ that unlocks access to these models.
Hereβs how you can create and use one.
If you already have a ChatGPT account,
you can use it directly π
Youβll need an OpenAI account first.
Now, letβs actually create your key π
Go to the OpenAI Dashboard (top-right menu).

In the left sidebar, click API keys.

Click βCreate new secret key.β

Choose any name you like (e.g., key4arxiv) and click βCreate secret key.β
Youβll get a key that starts with sk-.
β οΈ The key will be shown only once!
Make sure to copy and save it securely.
(If you forget it, youβll need to generate a new one π )

This part is really important.
If someone else gets your API key, they can use GPT under your billing account β so make sure itβs secure.
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxx
Then load it in your code π
import os
api_key = os.getenv("OPENAI_API_KEY")
In your GitHub repository β
Settings β Security β Secrets and variables β Actions
Add a new secret named OPENAI_API_KEY.
For example, the
arxiv-daily-plusproject
fetches new papers every day and uses this key
to summarize them with GPT.
.env to your .gitignore file