OpenAI / ChatGPT 订阅
官网: openai.com
Dline 提供两种使用 OpenAI 模型的方式:
- OpenAI:使用 OpenAI API Key,按 token 计费。
- ChatGPT Subscription:使用 ChatGPT 订阅账号登录,无需管理 API Key。
OpenAI API Key
Section titled “OpenAI API Key”获取 API Key
Section titled “获取 API Key”-
访问 OpenAI Platform,注册或登录账号。
-
打开 API keys 页面。
-
点击 Create new secret key,为 Key 起一个便于识别的名称,例如
Dline。 -
立即复制并妥善保存 Key,OpenAI 不会再次显示它。
在 Dline 中配置
Section titled “在 Dline 中配置”通用步骤见模型配置。
-
点击 Dline 面板标题栏的 Settings 按钮。
-
在 Provider 中选择 OpenAI。
-
把 Key 粘贴到 OpenAI API Key 输入框。
-
在 Model 中搜索或选择模型。
自定义 Base URL
Section titled “自定义 Base URL”保持 Use custom base URL 未勾选时,请求发送到 OpenAI。勾选后,请求改为发送到你填写的其他地址,例如自建网关或其他兼容 OpenAI API 的服务。
-
勾选 Use custom base URL,填入服务提供的地址,例如
https://gateway.example.com/v1。填写 API 地址本身,而不是服务商官网首页。 -
把该服务签发的 Key 粘贴到 OpenAI API Key 输入框。
-
在 Model 中选择模型。如果服务的模型 ID 未内置在 Dline 中,勾选 Use custom model ID 并在 Model ID 中手动输入。
Azure OpenAI
Section titled “Azure OpenAI”- 在 Use custom base URL 中填写 Azure OpenAI 资源的地址。
- 需要固定 API 版本时,勾选 Set Azure API version 并填写版本,默认
2024-10-01-preview。 - 勾选 Use Azure Identity Authentication 可以复用现有的 Azure 托管身份认证。它不会主动发起登录,只会复用已有的认证状态(例如
az login)。
ChatGPT 订阅
Section titled “ChatGPT 订阅”-
打开 Dline 设置,在 Provider 中选择 ChatGPT Subscription。
-
点击 Sign in。Dline 会打开 Sign in to ChatGPT 对话框并启动系统浏览器。
-
在浏览器中完成授权。浏览器自动回到 Dline 后,对话框关闭,状态显示 Signed in。
-
在 Model 中选择模型。可用模型取决于你的 ChatGPT 套餐。
浏览器无法自动返回时
Section titled “浏览器无法自动返回时”- 保持 Sign in to ChatGPT 对话框打开,不要取消。
- 从浏览器地址栏复制授权完成后的完整回调 URL。
- 粘贴到对话框中的 Full callback URL 输入框,然后点击 Finish sign-in。
浏览器没有自动打开时,可以复制对话框中的登录 URL,手动粘贴到浏览器。登录超时后点击 Try again 重新开始。
导入已有凭据
Section titled “导入已有凭据”正常登录无法完成时,可以在对话框中展开 Advanced: import OAuth credential JSON,粘贴完整的 OAuth 凭据 JSON,然后点击 Import credential。凭据会写入该 Profile 自己的密钥文件。
多个 Profile
Section titled “多个 Profile”每个 API Profile 独立保存自己的 ChatGPT 凭据。一个 Profile 登录、退出或删除,不会影响其他 Profile;需要使用多个 Profile 时,分别为每个 Profile 登录一次。
- 价格: 各模型的费用见 OpenAI 定价页。