Skip to content

How to Get OpenAI API Key

Jdaie edited this page Dec 1, 2025 · 2 revisions

Steps

  1. Sign up or log in to the OpenAI platform: https://platform.openai.com/
  2. Open the API Keys page (Manage → API keys).
  1. Create a new secret key and copy it (the key is usually shown only once).
  1. Secure storage and usage:
  • Store the key in environment variables or a secure key management service; do not commit it to version control or include it in frontend code.
  • Use it in server-side requests via the Authorization header: Authorization: Bearer YOUR_API_KEY (see official examples).
  1. Management and rotation:
  • Rotate keys regularly and revoke keys that are no longer used.
  • If available, use fine-grained API keys and restrict permissions and allowed usage.
  • Avoid exposing keys in client applications; use a backend proxy or controlled service to access the API.

Note — Billing and Quotas

  • The OpenAI API is a paid service; configure billing in your account to avoid service interruptions.
  • Review quotas and pricing; set budgets and alerts to prevent unexpected charges.
  • For request formats, SDK examples, and best practices, see the official documentation: https://platform.openai.com/docs

Clone this wiki locally