What is an API key, and why do AI apps ask for one? This guide explains it in plain words, shows how to get a key from an AI provider, and lists five habits that keep it safe.

01What is an API key?
An API is a door that lets apps talk to a service without a person clicking around a website. An API key is the key to that door.
It looks like a long line of letters and numbers. When an app sends a question to an online AI model, it sends the key along. The provider checks the key, answers, and counts the use on your account.
A password is for you. An API key is for your apps.
02When do you need an API key for AI?
| How you use AI | Key needed? | Why |
|---|---|---|
| A chat website or phone app | No | You sign in with your account. |
| Your own app or agent with an online model | Yes | The app has to prove which account it uses. |
| A local model on your own hardware | No | Nothing leaves for a provider, so there is no account to check. |
Local AI or online AI: what stays private explains the two kinds of AI.
03How to get an API key
The steps are much the same with every AI provider:
- Create a developer account with the provider. This is separate from the chat app.
- Add a way to pay. Providers bill API use by how much you use.
- Find the API keys page in the account settings and create a new key.
- Give it a name that says where you will use it, such as "home server".
- Copy it straight away. Most providers show the full key only once.
- Paste it into the app that needs it, in its settings.
04How to keep an API key safe
- NEVER SHARE ITDon't paste a key into a chat, an email, a forum post or a screenshot.
- ONE KEY PER APPIf one leaks, you delete that key and the rest keep working.
- SET A LIMITMost providers let you set a spending limit. Set one before you start.
- KEEP IT OUT OF SHARED FILESDon't save a key in a file you upload or share with others.
- DELETE WHAT YOU DON'T USEOld keys are open doors. Remove them.
Think a key has leaked? Delete it on the provider's site and make a new one. It takes a minute.
05What happens to your words when you use a key?
A key connects your app to an online model. So the text of each task you send goes to that provider, and the provider's own rules say how it is handled. A local model needs no key, and your words stay on your hardware.
06What this means for CosmolinkOS
In CosmolinkOS you only need an API key for online brains. You add your own key from a provider like Claude or OpenAI, and the welcome crew helps you add it. Local brains run through Ollama on your own hardware and don't need one.
07Questions people ask
What is an API key in simple words?
It is a long secret code that lets an app use an online service in your name. The service uses it to know which account is asking.
Is an API key the same as a password?
They do a similar job. A password lets you sign in. An API key lets an app sign in for you. Keep both secret.
Do I need an API key to run local AI?
No. A local model runs on your own hardware, so there is no provider account to check.
What happens if someone gets my API key?
They can use the service on your account until you delete the key. Delete it on the provider's site and create a new one.
Is a chat subscription the same as API access?
Usually not. Most providers keep the chat app and the API as separate accounts with separate billing.