外观
Continue 接入自定义 API
在 Continue 的 config.yaml 中添加一个 provider: openai 的模型,把 apiBase 设为 https://api.niceai.dev/v1,填入 NiceAI 密钥即可。
准备工作
- 在 VS Code 或 JetBrains 中安装 Continue 插件。
- 在 NiceAI 控制台「API 密钥」页面创建密钥,分组按所用模型选择。
配置 config.yaml
在 Continue 面板中打开配置(本地配置文件一般是 ~/.continue/config.yaml),在 models 下添加:
yaml
name: My Config
version: 0.0.1
schema: v1
models:
- name: NiceAI
provider: openai
model: <模型名,见模型广场>
apiBase: https://api.niceai.dev/v1
apiKey: <你的 NiceAI 密钥>| 字段 | 说明 |
|---|---|
provider | 填 openai,表示使用 OpenAI 兼容接口 |
model | 模型广场 中的模型名 |
apiBase | https://api.niceai.dev/v1,要带 /v1 |
apiKey | NiceAI 密钥 |
保存后在 Continue 的模型下拉框中选择 NiceAI,发一句话测试。
关于 Responses API
Continue 官方文档说明,它对部分 OpenAI 推理模型默认走 /responses 接口。如果遇到相关报错,可以在该模型下加 useResponsesApi: false,改走 /chat/completions。
常见问题
404?
apiBase 要带 /v1,不要填到 /chat/completions。详见 接口地址要不要加 /v1。
401?
检查 apiKey 是否正确、密钥是否启用。不要把含密钥的配置文件提交到 Git。