
Conifer SDK —— 一个用于云、本地和 BYOK 推断的网关,且提供精确的每次通话成本收据。TypeScript + Python + MCP。
概览
Conifer 是一个 API 网关。你有一个 API 密钥和一个基础 URL,背后是 OpenAI、Anthropic、Google、DeepSeek、Moonshot 等公司的模型。你不需要与每个供应商签约,也不需要同时管理五个密钥。 它能配合你已经用的工具,因为它支持OpenAI和Anthropic API。如果某个应用允许你设置自定义的基础URL和API密钥(Cursor、Cline、SillyTavern、LibreChat、Codex、Claude Code,任何使用openai包的软件),指向这里,它就能实现: 这就是整个产品。这个仓库是可选的 SDK,适合想要更多功能的人:一个 TypeScript 和 Python 客户端,加上一个 MCP 服务器。 这里有两个其他网关没有的东西: 1. ,以整数纳米美元计价的方式返回答案,列举明细。不是凭代币数量估算。2. 设置maxCostNanoUsd,如果可能花费更高,网关会在调用发生前拒绝该调用。 定价:你按模型的标价收费,没有加价。
概述(AI 翻译)
每个主要模型前都有一个API密钥——每次调用的精确成本。
文档 · 迁徙· 问题 · 贡献
这就是,简单来说
Conifer 是一个 API 网关。你有一个 API 密钥和一个基础 URL,并且在它背后 这些模型来自OpenAI、Anthropic、Google、DeepSeek、Moonshot等。你 不要同时与每个供应商签约,也不要同时兼顾五把钥匙。
它能配合你已经用的工具,因为它与OpenAI沟通,
拟人 API。如果某个应用允许你设置自定义的基础 URL 和 API 密钥(光标,
Cline、SillyTavern、LibreChat、Codex、Claude Code,任何使用openai的软件
package),指向这里,它就工作了:
这就是整个产品。这个仓库是为那些想要的人准备的可选 SDK 不仅仅是随插即用:包括TypeScript和Python客户端,以及MCP服务器。
这里有两个其他网关没有的东西:
- 每次通话的确切费用,并附上详细的答复,作为 纳米美元的整数。不是凭代币数量估算。
- 每个请求的硬性支出上限。 设置
maxCostNanoUsd和网关 如果可能花费更高,他会在电话发生前拒绝接听。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
What this is, in plain terms
Conifer is an API gateway. You get one API key and one base URL, and behind it are models from OpenAI, Anthropic, Google, DeepSeek, Moonshot and others. You do not sign up with each vendor and you do not juggle five keys.
It works with the tools you already use, because it speaks the OpenAI and
Anthropic APIs. If an app lets you set a custom base URL and API key (Cursor,
Cline, SillyTavern, LibreChat, Codex, Claude Code, anything using the openai
package), point it here and it works:
Base URL: https://api.conifer.build/v1
API key: sk-conifer-… (get one at https://conifer.build/console#/keys)
Model: claude-fable-5, gpt-5.5, deepseek-v4, …
That is the whole product. This repo is the optional SDK for people who want more than a drop-in: a TypeScript and Python client, plus an MCP server.
Two things you get here that other gateways do not:
- The exact cost of every call, returned with the answer, itemized, as an integer number of nanodollars. Not an estimate from token counts.
- A hard spending cap per request. Set
maxCostNanoUsdand the gateway refuses the call before it happens if it could cost more.
Pricing: you are charged the model’s own list price, no markup. If you’d rather use your own OpenAI/Anthropic keys, Conifer will proxy them for free.
See the router pick a model
Conifer can also pick the model for you based on how hard the question is. In the recording below, an easy question (“what port?”) goes to a cheap fast model and answers in 3 seconds. A hard one, with the dial set to best, goes to Claude Opus 5 and takes a minute. Same session, real screen recording, not sped up.
安装
npx -y conifer-sdk conifer-mcp配置
{
"mcpServers": {
"conifer": {
"command": "node",
"args": ["/path/to/use-conifer/bin/conifer-mcp.mjs"],
"env": { "CONIFER_API_KEY": "sk-conifer-…" }
}
}
}