BlazeInferDocs

Security best practices

Keep API keys on the server, rotate them, and know what to do if one leaks.

Never ship a key to a browser

A BlazeInfer API key gives access to your account and its credit balance. Keep keys on a server or a trusted backend. Never put them in client-side code, a mobile app or a public repository.

Do not call BlazeInfer from front-end code

A common mistake is calling BlazeInfer directly from front-end code to avoid building a backend. That exposes the key to anyone with a browser console. Send requests through your own server instead.

Read keys from the environment

Every example in these docs reads the key from BLAZE_API_KEY. Do the same in your code, and keep secrets out of version control:

import os
api_key = os.environ["BLAZE_API_KEY"]

Scope keys

  • A key belongs to a workspace. Create separate keys for separate projects or services, so that you can revoke one without disturbing the others.
  • Give keys an expiry where you can, and rotate them on a schedule.
  • Use a different key for each environment (development, staging, production).

Rotating and revoking

Create a new key in the console, deploy it, then revoke the old key in the console. A revoked key stops working straight away.

If a key leaks

  1. Revoke it in the console straight away.
  2. Create a replacement and update your deployment.
  3. Review usage in the console for unexpected spend.

On this page