Skip to content

API Tokens and Access Guides

AI APIs usually require an API key or token before your application can make requests. This page explains the role of those credentials and routes you to the right provider guide.

API keys are commonly used for:

  • authentication
  • access control
  • usage tracking
  • billing and quota enforcement
  • environment separation between development and production

Do this:

  • store keys in environment variables or a secrets manager
  • use different keys for local, staging, and production environments
  • restrict permissions where the provider supports it
  • rotate keys when they are exposed or no longer needed

Do not do this:

  • commit keys to source control
  • embed keys in client-side JavaScript
  • hardcode production keys into sample code
  • share the same key across unrelated projects
Provider Use this guide when you need Guide
OpenAI Text, multimodal, embeddings, or general API onboarding OpenAI API Key
Google Gemini Gemini API access through Google AI Studio or related tooling Google Gemini API Key
Anthropic Claude Claude access for assistant and reasoning workflows Anthropic Claude API Key
Hugging Face Hosted models, inference endpoints, and hub access Hugging Face API Token
Cohere Command, Embed, and reranking APIs Cohere API Key
Mistral AI Mistral-hosted model access Mistral AI API Key
  1. Choose the provider that matches your use case.
  2. Create the key in the provider console.
  3. Store it in an environment variable or secret store.
  4. Test it with a minimal request.
  5. Add usage monitoring before scaling up.
import os
api_key = os.getenv("YOUR_PROVIDER_API_KEY")
if not api_key:
raise RuntimeError("Set YOUR_PROVIDER_API_KEY before running this script.")