如何在OpenCode中使用Particle AI: Particle-1?
particle-ai/particle-1OpenCode 通过 UberLLM 的 OpenAI 兼容聊天地址访问Particle AI: Particle-1。在~/.config/opencode/opencode.json中,添加一个名为uberllm的提供商,该提供商使用@ai-sdk/openai-compatible包并将baseURL设置为https://api.uberllm.dev/v1,在其模型下添加particle-ai/particle-1,将您的 UberLLM 密钥放入UBERLLM_API_KEY环境变量中,然后使用/models选择uberllm/particle-ai/particle-1。 limit这些数字是Particle AI: Particle-1的上下文大小和最大回复;OpenCode 使用它们来判断何时压缩长时间会话。
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"uberllm": {
"npm": "@ai-sdk/openai-compatible",
"name": "UberLLM",
"options": {
"baseURL": "https://api.uberllm.dev/v1",
"apiKey": "{env:UBERLLM_API_KEY}"
},
"models": {
"particle-ai/particle-1": {
"name": "Particle AI: Particle-1",
"limit": {
"context": 1048576,
"output": 131072
}
}
}
}
},
"model": "uberllm/particle-ai/particle-1"
}OpenCode 调用:OpenAI 聊天补全 https://api.uberllm.dev/v1/chat/completions · 完整的OpenCode指南
把 ull_your_key 换成你的 UberLLM API 密钥。一个密钥可用于所有工具和所有模型。
通过 API,Particle AI: Particle-1 在三个地址上响应,使用相同的 UberLLM 密钥和模型 ID particle-ai/particle-1:位于https://api.uberllm.dev/v1/chat/completions的 OpenAI 聊天补全、位于https://api.uberllm.dev/v1/responses的 OpenAI Responses API 以及位于https://api.uberllm.dev/v1/messages的 Anthropic Messages API。