API keys connect your website to AI safely.

An API key is a private software password. It lets backend code call an AI service, CRM, database, or automation tool without exposing secrets in public browser code.

What it does

API keys

For AG Digitalz builds, private keys belong behind the system. The client should get the benefit of AI without leaking credentials or giving random visitors access to paid model calls.

Stack to use

Recommended setup

  • OpenAI, Anthropic, Google, or another provider account
  • Netlify environment variables
  • Serverless function or backend route
  • Key rotation process
  • Usage limits and logs
  • Separate development and production keys
Common mistakes

What to avoid

  • Putting keys in browser JavaScript.
  • Sharing screenshots of secret values.
  • Using one key for every project forever.
  • No spending limits.
  • No logs for failed requests.

Build the workflow step by step.

Connect the smallest useful flow first, make ownership clear, then measure it before expanding.

01

Step 1

Create the key in the provider dashboard.

02

Step 2

Store it in Netlify environment variables, not HTML or frontend JavaScript.

03

Step 3

Create a serverless function that reads the key privately.

04

Step 4

Call the AI provider from that function.

05

Step 5

Return only the safe result to the browser.

06

Step 6

Set usage limits and monitor errors.

07

Step 7

Rotate the key if it is exposed or no longer needed.

Official documentation behind this guide.

Use these sources to verify capabilities, limits, and setup details before putting a workflow into production.

Official source

OpenAI API keys

Reference documentation used for this AG Digitalz field guide.

Open source
Official source

OpenAI quickstart

Reference documentation used for this AG Digitalz field guide.

Open source
Official source

Netlify environment variables

Reference documentation used for this AG Digitalz field guide.

Open source