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
ProviderUse this guide when you needGuide
OpenAIText, multimodal, embeddings, or general API onboardingOpenAI API Key
Google GeminiGemini API access through Google AI Studio or related toolingGoogle Gemini API Key
Anthropic ClaudeClaude access for assistant and reasoning workflowsAnthropic Claude API Key
Hugging FaceHosted models, inference endpoints, and hub accessHugging Face API Token
CohereCommand, Embed, and reranking APIsCohere API Key
Mistral AIMistral-hosted model accessMistral 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.")