TronCode Tron CLI 供应商配置

供应商配置

配置 AI 供应商连接 Tron

概述

Tron 支持多种 AI 供应商,包括 Anthropic Claude、OpenAI、Google Gemini 和 TronCode 托管服务。你可以根据需求选择合适的供应商,也可以在使用过程中随时切换。

💡
推荐
推荐使用 TronCode 精选服务,经过质量筛选,开箱即用,无需繁琐配置。

TronCode(推荐)

TronCode 是由 Tron 团队提供的精选模型托管服务,汇集了多家顶级 AI 供应商的优质模型,经过严格质量筛选,确保稳定性和性能。

在 TUI 中使用 /connect 命令,选择 troncode,然后访问 platform.troncode.cn 获取 API Key。

也可以直接通过环境变量设置:

终端
export TRON_API_KEY=your_api_key_here

设置好环境变量后,启动 Tron 即可自动使用 TronCode 服务。

Anthropic

直接使用 Anthropic 提供的 Claude API,无需经过任何中间层。访问 console.anthropic.com 创建 API Key。

终端
export ANTHROPIC_API_KEY=sk-ant-your_key_here

在 TUI 中运行 /connect,选择 anthropic,然后粘贴你的 API Key 即可完成配置。

OpenAI

使用 OpenAI API,支持 GPT-4o、GPT-4o-mini 等模型。访问 platform.openai.com 获取 API Key。

终端
export OPENAI_API_KEY=sk-your_key_here

在 TUI 中运行 /connect,选择 openai,输入 API Key 完成配置。

Google Gemini

使用 Google 提供的 Gemini API,支持 Gemini 2.0 Flash、Gemini 1.5 Pro 等模型。访问 aistudio.google.com 获取 API Key。

终端
export GOOGLE_API_KEY=your_google_api_key_here

在 TUI 中运行 /connect,选择 google,输入 API Key 完成配置。

切换供应商

你可以在使用过程中随时切换供应商,无需重启 Tron。

在 TUI 中运行 /connect 命令,即可重新选择供应商和模型:

Tron TUI
tron
# 在 TUI 中输入:
/connect

也可以在 ~/.config/tron/config.json 中设置默认供应商,这样每次启动 Tron 时会自动使用该供应商:

json
{
  "provider": "troncode",
  "model": "claude-opus-4-6"
}