Skip to main content

Authentication

Every API request needs an API key.

Getting an API key​

API keys are created only on the FunAI developer platform:

  1. Sign in at developers.funai.art with your FunAI account, or sign up.
  2. Open API keys and create a key.
  3. Copy it straight away and store it somewhere safe. It starts with fa_live_ and is shown once; afterwards only its last characters are visible. If you lose it, rotate the key or create a new one.

Each key can have its own controls: a USD spend cap (daily, weekly, monthly or lifetime), an expiry date, an IP allow-list, a model allow-list, and allowed web origins or app bundle IDs.

Keys created in FunAI Studio before the developer platform launched keep working.

Keys are billed from your API balance on the developer platform, which is separate from FunAI Studio subscription credits. See Pricing & balance.

Sending the key​

The API accepts the key in either of two headers. Use one, not both.

Bearer token (what the OpenAI SDKs send):

Authorization: Bearer fa_live_...

X-API-Key header:

X-API-Key: fa_live_...

Example​

curl https://api.funai.art/v1/chat/completions \
-H "Authorization: Bearer $FUNAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-4o-mini", "messages": [{"role": "user", "content": "Hello world"}]}'

The same request with the other header:

curl https://api.funai.art/v1/chat/completions \
-H "X-API-Key: $FUNAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-4o-mini", "messages": [{"role": "user", "content": "Hello world"}]}'

A missing or invalid key returns 401. See Errors.

Checking a key​

GET https://api.funai.art/auth/key with the key returns its limits, its spend (daily, weekly, monthly and total) and the balance it bills.

curl https://api.funai.art/auth/key -H "Authorization: Bearer $FUNAI_API_KEY"

Keeping keys safe​

  • Server side only. Never put a key in browser or mobile app code. Call FunAI from your backend.
  • Use environment variables and keep keys out of version control.
  • Rotate a key you think has leaked: delete it on the developer platform and create a new one.