入门指南

配置 AI Provider

让 Agent 工作起来 — 添加 OpenAI / Anthropic / 兼容服务的 API Key。

什么是 Provider

Provider 是 Kition 调用大模型的渠道。你可以接 OpenAI 官方 API、Anthropic 官方 API,或者任何 OpenAI-compatible 的兼容端点(自架 vLLM、Ollama、OpenRouter、AiApiy、Azure OpenAI 等等)。每个 provider 由 baseURL + API Key + wire 协议组成。

免费档位限制:同一时刻只能配置 / 启用一个 provider — 切换是即时的。需要多 provider 同时挂载并按任务路由,看 free-vs-pro 文章。

配置步骤

配置一个新 provider 通常 30 秒以内:

  • 打开 Settings → Providers
  • 点击 Add Provider,选 OpenAI / Anthropic / Custom
  • 填 API Key 和 Base URL(兼容服务才需要 Base URL)
  • 设默认模型(比如 gpt-4o-mini / claude-sonnet-4
  • 点 Test 验证连通
  • 保存 → 在 Agent 面板看到 "ready"

常见 Provider 速查

下面是常见 provider 的连接信息。wire 字段决定 Kition 用哪种 API 协议封装请求 — 选错会出 4xx 错误。

  • OpenAI:https://api.openai.com/v1,wire = responses
  • Anthropic:https://api.anthropic.com,wire = anthropic_messages
  • AiApiy:从控制台获取 baseURL,wire = responses
  • OpenRouter:https://openrouter.ai/api/v1,wire = responses
  • Azure OpenAI:https://{resource}.openai.azure.com/openai,wire = responses,需要 api-version query
  • 自架 Ollama:http://localhost:11434/v1,wire = responses
  • 自架 vLLM:http://your-host:8000/v1,wire = responses

配置文件示例

想直接编辑配置文件?Provider 配置存在 .kition/providers.json,API Key 字段是占位符 — 真正的 Key 在 OS Keychain 里。手动改这个文件之前先在 UI 退出,否则 sidecar 会覆盖你的修改。

{
  "providers": [
    {
      "id": "openai-personal",
      "name": "OpenAI (Personal)",
      "wire": "responses",
      "baseUrl": "https://api.openai.com/v1",
      "apiKeyRef": "keychain:kition.openai.personal",
      "defaultModel": "gpt-4o-mini",
      "models": ["gpt-4o", "gpt-4o-mini", "o3-mini"]
    },
    {
      "id": "anthropic-work",
      "name": "Anthropic (Work)",
      "wire": "anthropic_messages",
      "baseUrl": "https://api.anthropic.com",
      "apiKeyRef": "keychain:kition.anthropic.work",
      "defaultModel": "claude-sonnet-4-5",
      "models": ["claude-opus-4-5", "claude-sonnet-4-5", "claude-haiku-4-5"]
    }
  ],
  "active": "openai-personal"
}

验证 + 排错

Settings → Providers → Test 会发起一次最小请求(一个 token 的 ping)来验证。失败时弹出的提示已经包含 HTTP 状态码和响应片段 — 通常足以定位问题。

  • 401 Unauthorized:Key 错或者过期 — 复制时小心首尾空格
  • 403 Forbidden:账户没开通该模型,或者 Anthropic 没充值
  • 404 Not Found:baseURL 末尾 /v1 漏了,或者模型 ID 拼错
  • 429 Rate Limited:触发限速 — 选更高档位或换 provider
  • TLS / 证书错误:企业网中间人 — 见下一节
  • 连接超时:sidecar 没起来 — 看底部状态栏圆点

企业网 / 代理 / 自定义 CA

公司网络里常常有 SSL 中间人 — Kition 默认不信任系统 CA store 之外的证书。把企业 CA 证书放到 Vault 的 .kition/certs/ 目录,启动时自动加载。也可以走 HTTPS_PROXY / NO_PROXY 环境变量。

# Tell Kition where to find the corporate CA bundle
export KITION_CA_BUNDLE=/etc/ssl/certs/corp-ca.pem

# Force everything through a corporate proxy except localhost
export HTTPS_PROXY=http://proxy.corp.example:8080
export NO_PROXY=localhost,127.0.0.1

相关文档

下载 Kition

本地优先的 AI 工作空间。Markdown 文档、结构化数据表、AI Agent,全部跑在你自己的电脑上。