An API key is the password to your balance. A few habits make a leaked key a non-event instead of an expensive surprise.
Make one key per project
Create keys from API Keys in your dashboard. Instead of one key everywhere, make one per app or machine: website-prod, telegram-bot, laptop. When you look at Usage Logs you'll see which key spent what, and if one leaks you only revoke that one.
Set a monthly limit
Each key can have a monthly spending limit. Once a key has spent that much in the calendar month (UTC), further requests with it are refused, while your other keys keep working. Good starting points:
- Personal testing: a few dollars
- A side project in production: what you'd be comfortable losing in a bad month
- Anything that runs unattended (cron jobs, bots): always set one
Store keys outside your code
# .env (add .env to .gitignore!)
DEVSAIO_API_KEY=sk-...import os
from openai import OpenAI
client = OpenAI(base_url="https://devsaio.lol/v1", api_key=os.environ["DEVSAIO_API_KEY"])Warning: Never put a key in browser JavaScript, a mobile app bundle or a public repository. Anyone can read those. Call the API from your server instead.
Rotate without downtime
- Create a new key.
- Deploy it to your app.
- Watch Usage Logs until the old key has no traffic.
- Revoke the old key.
If a key leaks
Revoke it immediately from the dashboard; it stops working at once. Then create a replacement and check the usage log for requests you don't recognise. Read the full API key security checklist for more.
Claude, GPT, Gemini, DeepSeek, image and video models through one OpenAI- and Anthropic-compatible endpoint. Prepaid, pay only for what you use.