认证¶
OpenAI API 使用 API 密钥进行认证。访问您的 API 密钥页面检索您将在请求中使用的 API 密钥。
记住,你的 API 密钥是一个秘密!不要与他人共享或在任何客户端代码(浏览器,应用程序)中公开它。 生产请求必须通过您自己的后端服务器路由,您的 API 密钥可以从环境变量或密钥管理服务安全地加载。
All API requests should include your API key in an Authorization HTTP header as follows:
Authorization: Bearer YOUR_API_KEY Requesting organization For users who belong to multiple organizations, you can pass a header to specify which organization is used for an API request. Usage from these API requests will count against the specified organization's subscription quota.
Example curl command:
Example with the openai Python package:
Example with the openai Node.js package:
Organization IDs can be found on your Organization settings page.