API Keys

Create, view, edit and delete API keys (tokens) in the console, and set quota, expiry, allowed models and an IP allowlist.

API keys (tokens) are managed on the "API Keys" page in the console's left menu: https://ai.myaiexp.com/keys. The table shows each key's name, status, masked key, quota (remaining and used), allowed models, IP restriction, created and last-used time, expiry and more.

Above the list you can search by name or by key, filter by status (such as enabled, disabled, expired or exhausted), and choose which columns to show.

Create an API key

  1. Open "API Keys" and click "Create API Key" to open the form.
  2. Enter a name, and optionally set an expiry time and how many keys to create at once.
  3. Set the quota: either unlimited (limited only by your account balance), or turn that off and enter a quota limit in USD.
  4. To restrict the key, open the advanced settings to pick the allowed models and enter an IP allowlist.
  5. Save. The new key appears in the list.

Options

OptionWhat it doesRecommendation
NameOnly for your own referenceName it after the project, e.g. blog-bot
ExpiryThe key stops working after this time; never expires by default. Pick a common duration or choose a date and timeAlways set an expiry for keys given to outside collaborators
QuantityCreate several keys at once; names get a suffix automaticallyUseful when handing keys to several people
Quota (USD)The most this key can spend; with unlimited quota it is limited only by your account balanceGive scripts and third-party tools their own small quota
Model restrictionThe models this key may call; leave empty to allow allUse it to prevent accidental use of pricier models, e.g. allow only one lower-priced model
IP allowlistOnly accept requests from the listed IPs; CIDR notation is supportedRecommended when your server has a fixed egress IP

If the form shows a "Group" option, leave it at the default. The models a key can call are whatever GET /v1/models returns for that key.

Treat an API key like a password. Never commit a full key to a repository or put it in screenshots, logs or chat tools; if you suspect a leak, delete it immediately and create a new one.

View and copy a key

Keys in the list are masked by default (for example sk-AbCd**********WxYz):

  • Click the masked key to see the full value.
  • Click the copy icon next to it to copy the full key.
  • The menu in the "Actions" column also has a copy entry; there is also "Copy Connection Info", which copies the key together with the service URL, for clients that support importing it.

Base URLs to use when calling the API:

  • OpenAI SDK / OpenAI-compatible clients: https://ai.myaiexp.com/v1
  • Anthropic SDK / Claude Code: https://ai.myaiexp.com (no /v1)

Edit, disable and delete

In the "Actions" column of the list:

  • Edit: change the name, quota, expiry, model restriction and other settings (the key itself does not change).
  • Disable: keep the settings but stop all calls immediately; you can re-enable it later.
  • Delete: the key stops working immediately and cannot be restored.

Select several rows to delete them in bulk. The "CC Switch" item in the actions menu imports the key into CC Switch on your machine in one click; see CC Switch.

Check a key and its remaining quota

The key list in the console shows used quota, total quota and the usage ratio (in USD). You can also query the current key through the API:

usage.sh
# Query the current key's quota (unit is "quota"; 500000 quota = 1 USD)
curl -sS https://ai.myaiexp.com/api/usage/token/ \
  -H "Authorization: Bearer $MYAIEXP_API_KEY"

Example response:

{
  "code": true,
  "data": {
    "name": "my-first-key",
    "total_granted": 2500000,
    "total_used": 1825,
    "total_available": 2498175,
    "unlimited_quota": false,
    "expires_at": 0,
    "model_limits_enabled": false
  },
  "message": "ok"
}

The fields are in quota units: total_available / 500000 is the remaining balance in USD. expires_at of 0 means the key never expires.

Security tips

  • One key per project, so a leak only means deleting that one.
  • Never put a key in frontend code or commit it; keep it in server-side environment variables.
  • If you see unexpected spending, first disable or delete the key in the console, then trace the source in Usage Logs.

This service is provided for learning and research purposes only. Please follow each model provider's usage policies.

On this page