Models
Cline
Cline 是运行在 VS Code 里的编码 agent,你配置哪个 provider 它就跟哪个通信。和那些经由厂商服务器代理的编辑器集成不同,Cline 从你的机器上直接调用端点,所以它只需要一个 Grafilab 的 base URL 和密钥。
- 已在 VS Code 里安装 Cline,并打开了它的侧边栏面板。
- A Grafilab API key. In the console open API (
https://app.grafilab.ai/api) and click Generate New Key — see API Keys.
把密钥命名为 cline,这样它的花费就和其他工具分开了。
选择 model id
Section titled “选择 model id”The model catalog is live, so list it rather than copying ids from a page. Every entry’s id is the exact string to use in any tool or SDK.
curl https://llm.grafilab.ai/v1/models \ -H "Authorization: Bearer $GRAFILAB_API_KEY" | jq -r '.data[].id'from openai import OpenAI
client = OpenAI(api_key="sk-grafilab-...", base_url="https://llm.grafilab.ai/v1")for model in client.models.list(): print(model.id)import OpenAI from "openai";
const client = new OpenAI({ apiKey: "sk-grafilab-...", baseURL: "https://llm.grafilab.ai/v1" });for await (const model of client.models.list()) { console.log(model.id);}The same ids appear as cards in the Playground, with context size and prices.
Cline 会原样发送 Model ID 这个字符串,所以它必须和目录里的 id 完全一致。
把 Cline 连到 Grafilab
Section titled “把 Cline 连到 Grafilab”-
打开 Cline 面板,点击 ⚙️ 设置图标。API 配置是第一部分。
-
把 API Provider 设为 OpenAI Compatible。
-
把 Base URL 设为:
https://llm.grafilab.ai/v1Cline 会自己补上
/chat/completions,所以这个值到/v1为止。 -
把你的 Grafilab 密钥粘贴到 API Key。Use Azure Identity Authentication 保持不勾选。
-
在 Model 字段里填入你的 Grafilab model id(有些版本里这个字段叫 Model ID)。
-
打开 Model Configuration,把 Cline 无法从兼容 OpenAI 的端点上自动获取的信息填进去。
字段 值从哪里来 Context Window 模型在 Playground 卡片上的 Context 数值 Max Output Tokens 模型的输出上限;不确定就保持默认 Image Support 只有多模态模型才开启 Computer Use 除非模型声明支持工具调用且你已经测过,否则保持关闭 Input Price / Output Price Playground 卡片上的 Input 和 Output 价格 这些价格只喂给 Cline 自己的费用计数器。不管你在这里填什么,Grafilab 都按目录价计费,所以填错只会得到误导性的估算,不会扣错钱。
-
选择 Done,然后给 Cline 一个小任务——「list the files in this folder and summarise what the project does」是个不错的开始。
另一种做法:Anthropic provider
Section titled “另一种做法:Anthropic provider”Cline 也能用 Anthropic 格式跟 Grafilab 通信。把 API Provider 设为 Anthropic,勾选 Use custom base URL,然后填入裸 origin:
https://llm.grafilab.ai再粘贴同一个密钥,输入同一个 model id。注意这里没有 /v1——Anthropic 客户端会自己补上 /v1/messages。
你基本上用不到这种做法。只有当某个 Cline 功能非要 Messages 格式时才值得一试。有一个能看出来的差别:Grafilab 接受但忽略 cache_control,所以整个会话里 Cline 的缓存写入计数一直是 0,尽管缓存读取会正常上报。
Cline 会在每个任务下面显示 token 数和估算费用。第一个任务完成后,在控制台打开 API,在 cline 密钥上选择 View Usage,确认今天有请求落下来。用量汇总最多可能延迟 30 分钟左右。
- 手动设置上下文窗口。 Cline 无法从兼容 OpenAI 的端点读取上下文大小,所以它的默认值只是猜的。设太大,Cline 会拼出模型拒收的提示词;设太小,它会无谓地截断你的文件。
- 图片需要多模态模型。 在纯文本模型上给任务附带截图,失败发生在 API 层,而不是 Cline 里。
- 推理过程以
reasoning_content返回。 Grafilab 在reasoning和reasoning_content两个字段里返回相同的文本。Cline 是否渲染它们取决于扩展版本。 429表示钱包空了。 Grafilab 用429表示余额不足而不是吞吐量超限,所以 Cline 报的限流消息其实是账单信号。到控制台充值。- 长任务可能卡住。 每个上游调用的首个 token 有 120 秒的时间上限。如果请求在产生任何输出之前就断了,重试即可;这部分工作不会计费。

