Codex

把 bInference 作为模型提供方添加到 Codex CLI。

Codex 使用 Responses 格式。在 ~/.codex/config.toml 中添加一个模型提供方:

~/.codex/config.toml
model_provider = "binference"
model = "openai/gpt-6.1-sol"
web_search = "disabled"

[model_providers.binference]
name = "bInference"
base_url = "https://binference.io/api/v1"
env_key = "BINF_API_KEY"
wire_api = "responses"

这里不提供 Codex 内置的图片工具:bInference 会把它从每个请求中去掉,其他功能照常使用。Codex 还会在每次调用中提供联网搜索,而且不限制一次调用能搜索多少次,所以 bInference 必须在调用开始前预留多轮搜索的费用(即使是小模型也超过 $10)。web_search = "disabled" 能让每次调用的预留保持很小;如果额度充足,你也可以保持开启。

然后在环境变量中设置好密钥,启动 Codex:

export BINF_API_KEY="binf_..."
codex

列表中的任何模型都可以作为 model。Codex 会重试返回 503 的请求,所以模型繁忙或我们这边的短暂等待都会自行恢复。