Add Together AI model support with Llama, DeepSeek, and Qwen models
This commit is contained in:
parent
c8063bdcd8
commit
61943b10c7
121
src/agents/together-models.ts
Normal file
121
src/agents/together-models.ts
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
import type { ModelDefinitionConfig } from "../config/types.js";
|
||||||
|
|
||||||
|
export const TOGETHER_BASE_URL = "https://api.together.xyz/v1";
|
||||||
|
export const TOGETHER_DEFAULT_MODEL_ID = "meta-llama/Llama-3.3-70B-Instruct-Turbo";
|
||||||
|
export const TOGETHER_DEFAULT_MODEL_REF = `together/${TOGETHER_DEFAULT_MODEL_ID}`;
|
||||||
|
|
||||||
|
export const TOGETHER_MODEL_CATALOG = [
|
||||||
|
{
|
||||||
|
id: "meta-llama/Llama-3.3-70B-Instruct-Turbo",
|
||||||
|
name: "Llama 3.3 70B Instruct Turbo",
|
||||||
|
reasoning: false,
|
||||||
|
input: ["text"],
|
||||||
|
contextWindow: 131072,
|
||||||
|
maxTokens: 8192,
|
||||||
|
cost: {
|
||||||
|
input: 0.88,
|
||||||
|
output: 0.88,
|
||||||
|
cacheRead: 0.88,
|
||||||
|
cacheWrite: 0.88,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "meta-llama/Llama-4-Scout-17B-16E-Instruct",
|
||||||
|
name: "Llama 4 Scout 17B 16E Instruct",
|
||||||
|
reasoning: false,
|
||||||
|
input: ["text", "image"],
|
||||||
|
contextWindow: 10000000,
|
||||||
|
maxTokens: 32768,
|
||||||
|
cost: {
|
||||||
|
input: 0.18,
|
||||||
|
output: 0.59,
|
||||||
|
cacheRead: 0.18,
|
||||||
|
cacheWrite: 0.18,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8",
|
||||||
|
name: "Llama 4 Maverick 17B 128E Instruct FP8",
|
||||||
|
reasoning: false,
|
||||||
|
input: ["text", "image"],
|
||||||
|
contextWindow: 20000000,
|
||||||
|
maxTokens: 32768,
|
||||||
|
cost: {
|
||||||
|
input: 0.27,
|
||||||
|
output: 0.85,
|
||||||
|
cacheRead: 0.27,
|
||||||
|
cacheWrite: 0.27,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "deepseek-ai/DeepSeek-V3.1",
|
||||||
|
name: "DeepSeek V3.1",
|
||||||
|
reasoning: false,
|
||||||
|
input: ["text"],
|
||||||
|
contextWindow: 131072,
|
||||||
|
maxTokens: 8192,
|
||||||
|
cost: {
|
||||||
|
input: 0.6,
|
||||||
|
output: 1.25,
|
||||||
|
cacheRead: 0.6,
|
||||||
|
cacheWrite: 0.6,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "deepseek-ai/DeepSeek-R1",
|
||||||
|
name: "DeepSeek R1",
|
||||||
|
reasoning: true,
|
||||||
|
input: ["text"],
|
||||||
|
contextWindow: 131072,
|
||||||
|
maxTokens: 8192,
|
||||||
|
cost: {
|
||||||
|
input: 3.0,
|
||||||
|
output: 7.0,
|
||||||
|
cacheRead: 3.0,
|
||||||
|
cacheWrite: 3.0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "Qwen/Qwen2.5-72B-Instruct-Turbo",
|
||||||
|
name: "Qwen 2.5 72B Instruct Turbo",
|
||||||
|
reasoning: false,
|
||||||
|
input: ["text"],
|
||||||
|
contextWindow: 131072,
|
||||||
|
maxTokens: 8192,
|
||||||
|
cost: {
|
||||||
|
input: 0.35,
|
||||||
|
output: 0.8,
|
||||||
|
cacheRead: 0.35,
|
||||||
|
cacheWrite: 0.35,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "mistralai/Mixtral-8x7B-Instruct-v0.1",
|
||||||
|
name: "Mixtral 8x7B Instruct v0.1",
|
||||||
|
reasoning: false,
|
||||||
|
input: ["text"],
|
||||||
|
contextWindow: 32768,
|
||||||
|
maxTokens: 8192,
|
||||||
|
cost: {
|
||||||
|
input: 0.6,
|
||||||
|
output: 0.6,
|
||||||
|
cacheRead: 0.6,
|
||||||
|
cacheWrite: 0.6,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export function buildTogetherModelDefinition(
|
||||||
|
model: (typeof TOGETHER_MODEL_CATALOG)[number],
|
||||||
|
): ModelDefinitionConfig {
|
||||||
|
return {
|
||||||
|
id: model.id,
|
||||||
|
name: model.name,
|
||||||
|
api: "openai-completions",
|
||||||
|
reasoning: model.reasoning,
|
||||||
|
input: [...model.input],
|
||||||
|
cost: model.cost,
|
||||||
|
contextWindow: model.contextWindow,
|
||||||
|
maxTokens: model.maxTokens,
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -164,6 +164,12 @@ describe("cli program (smoke)", () => {
|
|||||||
key: "sk-moonshot-test",
|
key: "sk-moonshot-test",
|
||||||
field: "moonshotApiKey",
|
field: "moonshotApiKey",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
authChoice: "together-api-key",
|
||||||
|
flag: "--together-api-key",
|
||||||
|
key: "sk-together-test",
|
||||||
|
field: "togetherApiKey",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
authChoice: "kimi-code-api-key",
|
authChoice: "kimi-code-api-key",
|
||||||
flag: "--kimi-code-api-key",
|
flag: "--kimi-code-api-key",
|
||||||
|
|||||||
@ -52,7 +52,7 @@ export function registerOnboardCommand(program: Command) {
|
|||||||
.option("--mode <mode>", "Wizard mode: local|remote")
|
.option("--mode <mode>", "Wizard mode: local|remote")
|
||||||
.option(
|
.option(
|
||||||
"--auth-choice <choice>",
|
"--auth-choice <choice>",
|
||||||
"Auth: setup-token|claude-cli|token|chutes|openai-codex|openai-api-key|openrouter-api-key|ai-gateway-api-key|moonshot-api-key|kimi-code-api-key|synthetic-api-key|codex-cli|gemini-api-key|zai-api-key|apiKey|minimax-api|minimax-api-lightning|opencode-zen|skip",
|
"Auth: setup-token|claude-cli|token|chutes|openai-codex|openai-api-key|openrouter-api-key|ai-gateway-api-key|moonshot-api-key|kimi-code-api-key|synthetic-api-key|together-api-key|codex-cli|gemini-api-key|zai-api-key|apiKey|minimax-api|minimax-api-lightning|opencode-zen|skip",
|
||||||
)
|
)
|
||||||
.option(
|
.option(
|
||||||
"--token-provider <id>",
|
"--token-provider <id>",
|
||||||
@ -74,6 +74,7 @@ export function registerOnboardCommand(program: Command) {
|
|||||||
.option("--zai-api-key <key>", "Z.AI API key")
|
.option("--zai-api-key <key>", "Z.AI API key")
|
||||||
.option("--minimax-api-key <key>", "MiniMax API key")
|
.option("--minimax-api-key <key>", "MiniMax API key")
|
||||||
.option("--synthetic-api-key <key>", "Synthetic API key")
|
.option("--synthetic-api-key <key>", "Synthetic API key")
|
||||||
|
.option("--together-api-key <key>", "Together AI API key")
|
||||||
.option("--opencode-zen-api-key <key>", "OpenCode Zen API key")
|
.option("--opencode-zen-api-key <key>", "OpenCode Zen API key")
|
||||||
.option("--gateway-port <port>", "Gateway port")
|
.option("--gateway-port <port>", "Gateway port")
|
||||||
.option("--gateway-bind <mode>", "Gateway bind: loopback|tailnet|lan|auto|custom")
|
.option("--gateway-bind <mode>", "Gateway bind: loopback|tailnet|lan|auto|custom")
|
||||||
|
|||||||
@ -101,6 +101,7 @@ describe("buildAuthChoiceOptions", () => {
|
|||||||
|
|
||||||
expect(options.some((opt) => opt.value === "moonshot-api-key")).toBe(true);
|
expect(options.some((opt) => opt.value === "moonshot-api-key")).toBe(true);
|
||||||
expect(options.some((opt) => opt.value === "kimi-code-api-key")).toBe(true);
|
expect(options.some((opt) => opt.value === "kimi-code-api-key")).toBe(true);
|
||||||
|
expect(options.some((opt) => opt.value === "together-api-key")).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("includes Vercel AI Gateway auth choice", () => {
|
it("includes Vercel AI Gateway auth choice", () => {
|
||||||
@ -115,6 +116,18 @@ describe("buildAuthChoiceOptions", () => {
|
|||||||
expect(options.some((opt) => opt.value === "ai-gateway-api-key")).toBe(true);
|
expect(options.some((opt) => opt.value === "ai-gateway-api-key")).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("includes Together AI auth choice", () => {
|
||||||
|
const store: AuthProfileStore = { version: 1, profiles: {} };
|
||||||
|
const options = buildAuthChoiceOptions({
|
||||||
|
store,
|
||||||
|
includeSkip: false,
|
||||||
|
includeClaudeCliIfMissing: true,
|
||||||
|
platform: "darwin",
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(options.some((opt) => opt.value === "together-api-key")).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
it("includes Synthetic auth choice", () => {
|
it("includes Synthetic auth choice", () => {
|
||||||
const store: AuthProfileStore = { version: 1, profiles: {} };
|
const store: AuthProfileStore = { version: 1, profiles: {} };
|
||||||
const options = buildAuthChoiceOptions({
|
const options = buildAuthChoiceOptions({
|
||||||
|
|||||||
@ -202,6 +202,11 @@ export function buildAuthChoiceOptions(params: {
|
|||||||
label: "Venice AI API key",
|
label: "Venice AI API key",
|
||||||
hint: "Privacy-focused inference (uncensored models)",
|
hint: "Privacy-focused inference (uncensored models)",
|
||||||
});
|
});
|
||||||
|
options.push({
|
||||||
|
value: "together-api-key",
|
||||||
|
label: "Together AI API key",
|
||||||
|
hint: "Access to Llama, DeepSeek, Qwen, and more open models",
|
||||||
|
});
|
||||||
options.push({
|
options.push({
|
||||||
value: "github-copilot",
|
value: "github-copilot",
|
||||||
label: "GitHub Copilot (GitHub device login)",
|
label: "GitHub Copilot (GitHub device login)",
|
||||||
|
|||||||
@ -23,6 +23,8 @@ import {
|
|||||||
applyOpenrouterProviderConfig,
|
applyOpenrouterProviderConfig,
|
||||||
applySyntheticConfig,
|
applySyntheticConfig,
|
||||||
applySyntheticProviderConfig,
|
applySyntheticProviderConfig,
|
||||||
|
applyTogetherConfig,
|
||||||
|
applyTogetherProviderConfig,
|
||||||
applyVeniceConfig,
|
applyVeniceConfig,
|
||||||
applyVeniceProviderConfig,
|
applyVeniceProviderConfig,
|
||||||
applyVercelAiGatewayConfig,
|
applyVercelAiGatewayConfig,
|
||||||
@ -32,6 +34,7 @@ import {
|
|||||||
MOONSHOT_DEFAULT_MODEL_REF,
|
MOONSHOT_DEFAULT_MODEL_REF,
|
||||||
OPENROUTER_DEFAULT_MODEL_REF,
|
OPENROUTER_DEFAULT_MODEL_REF,
|
||||||
SYNTHETIC_DEFAULT_MODEL_REF,
|
SYNTHETIC_DEFAULT_MODEL_REF,
|
||||||
|
TOGETHER_DEFAULT_MODEL_REF,
|
||||||
VENICE_DEFAULT_MODEL_REF,
|
VENICE_DEFAULT_MODEL_REF,
|
||||||
VERCEL_AI_GATEWAY_DEFAULT_MODEL_REF,
|
VERCEL_AI_GATEWAY_DEFAULT_MODEL_REF,
|
||||||
setGeminiApiKey,
|
setGeminiApiKey,
|
||||||
@ -40,6 +43,7 @@ import {
|
|||||||
setOpencodeZenApiKey,
|
setOpencodeZenApiKey,
|
||||||
setOpenrouterApiKey,
|
setOpenrouterApiKey,
|
||||||
setSyntheticApiKey,
|
setSyntheticApiKey,
|
||||||
|
setTogetherApiKey,
|
||||||
setVeniceApiKey,
|
setVeniceApiKey,
|
||||||
setVercelAiGatewayApiKey,
|
setVercelAiGatewayApiKey,
|
||||||
setZaiApiKey,
|
setZaiApiKey,
|
||||||
@ -83,6 +87,8 @@ export async function applyAuthChoiceApiProviders(
|
|||||||
authChoice = "synthetic-api-key";
|
authChoice = "synthetic-api-key";
|
||||||
} else if (params.opts.tokenProvider === "venice") {
|
} else if (params.opts.tokenProvider === "venice") {
|
||||||
authChoice = "venice-api-key";
|
authChoice = "venice-api-key";
|
||||||
|
} else if (params.opts.tokenProvider === "together") {
|
||||||
|
authChoice = "together-api-key";
|
||||||
} else if (params.opts.tokenProvider === "opencode") {
|
} else if (params.opts.tokenProvider === "opencode") {
|
||||||
authChoice = "opencode-zen";
|
authChoice = "opencode-zen";
|
||||||
}
|
}
|
||||||
@ -579,5 +585,63 @@ export async function applyAuthChoiceApiProviders(
|
|||||||
return { config: nextConfig, agentModelOverride };
|
return { config: nextConfig, agentModelOverride };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (authChoice === "together-api-key") {
|
||||||
|
let hasCredential = false;
|
||||||
|
|
||||||
|
if (!hasCredential && params.opts?.token && params.opts?.tokenProvider === "together") {
|
||||||
|
await setTogetherApiKey(normalizeApiKeyInput(params.opts.token), params.agentDir);
|
||||||
|
hasCredential = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasCredential) {
|
||||||
|
await params.prompter.note(
|
||||||
|
[
|
||||||
|
"Together AI provides access to leading open-source models including Llama, DeepSeek, Qwen, and more.",
|
||||||
|
"Get your API key at: https://api.together.xyz/settings/api-keys",
|
||||||
|
].join("\n"),
|
||||||
|
"Together AI",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const envKey = resolveEnvApiKey("together");
|
||||||
|
if (envKey) {
|
||||||
|
const useExisting = await params.prompter.confirm({
|
||||||
|
message: `Use existing TOGETHER_API_KEY (${envKey.source}, ${formatApiKeyPreview(envKey.apiKey)})?`,
|
||||||
|
initialValue: true,
|
||||||
|
});
|
||||||
|
if (useExisting) {
|
||||||
|
await setTogetherApiKey(envKey.apiKey, params.agentDir);
|
||||||
|
hasCredential = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!hasCredential) {
|
||||||
|
const key = await params.prompter.text({
|
||||||
|
message: "Enter Together AI API key",
|
||||||
|
validate: validateApiKeyInput,
|
||||||
|
});
|
||||||
|
await setTogetherApiKey(normalizeApiKeyInput(String(key)), params.agentDir);
|
||||||
|
}
|
||||||
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
||||||
|
profileId: "together:default",
|
||||||
|
provider: "together",
|
||||||
|
mode: "api_key",
|
||||||
|
});
|
||||||
|
{
|
||||||
|
const applied = await applyDefaultModelChoice({
|
||||||
|
config: nextConfig,
|
||||||
|
setDefaultModel: params.setDefaultModel,
|
||||||
|
defaultModel: TOGETHER_DEFAULT_MODEL_REF,
|
||||||
|
applyDefaultConfig: applyTogetherConfig,
|
||||||
|
applyProviderConfig: applyTogetherProviderConfig,
|
||||||
|
noteDefault: TOGETHER_DEFAULT_MODEL_REF,
|
||||||
|
noteAgentModel,
|
||||||
|
prompter: params.prompter,
|
||||||
|
});
|
||||||
|
nextConfig = applied.config;
|
||||||
|
agentModelOverride = applied.agentModelOverride ?? agentModelOverride;
|
||||||
|
}
|
||||||
|
return { config: nextConfig, agentModelOverride };
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ const PREFERRED_PROVIDER_BY_AUTH_CHOICE: Partial<Record<AuthChoice, string>> = {
|
|||||||
"zai-api-key": "zai",
|
"zai-api-key": "zai",
|
||||||
"synthetic-api-key": "synthetic",
|
"synthetic-api-key": "synthetic",
|
||||||
"venice-api-key": "venice",
|
"venice-api-key": "venice",
|
||||||
|
"together-api-key": "together",
|
||||||
"github-copilot": "github-copilot",
|
"github-copilot": "github-copilot",
|
||||||
"copilot-proxy": "copilot-proxy",
|
"copilot-proxy": "copilot-proxy",
|
||||||
"minimax-cloud": "minimax",
|
"minimax-cloud": "minimax",
|
||||||
|
|||||||
@ -4,6 +4,11 @@ import {
|
|||||||
SYNTHETIC_DEFAULT_MODEL_REF,
|
SYNTHETIC_DEFAULT_MODEL_REF,
|
||||||
SYNTHETIC_MODEL_CATALOG,
|
SYNTHETIC_MODEL_CATALOG,
|
||||||
} from "../agents/synthetic-models.js";
|
} from "../agents/synthetic-models.js";
|
||||||
|
import {
|
||||||
|
buildTogetherModelDefinition,
|
||||||
|
TOGETHER_BASE_URL,
|
||||||
|
TOGETHER_MODEL_CATALOG,
|
||||||
|
} from "../agents/together-models.js";
|
||||||
import {
|
import {
|
||||||
buildVeniceModelDefinition,
|
buildVeniceModelDefinition,
|
||||||
VENICE_BASE_URL,
|
VENICE_BASE_URL,
|
||||||
@ -13,6 +18,7 @@ import {
|
|||||||
import type { ClawdbotConfig } from "../config/config.js";
|
import type { ClawdbotConfig } from "../config/config.js";
|
||||||
import {
|
import {
|
||||||
OPENROUTER_DEFAULT_MODEL_REF,
|
OPENROUTER_DEFAULT_MODEL_REF,
|
||||||
|
TOGETHER_DEFAULT_MODEL_REF,
|
||||||
VERCEL_AI_GATEWAY_DEFAULT_MODEL_REF,
|
VERCEL_AI_GATEWAY_DEFAULT_MODEL_REF,
|
||||||
ZAI_DEFAULT_MODEL_REF,
|
ZAI_DEFAULT_MODEL_REF,
|
||||||
} from "./onboard-auth.credentials.js";
|
} from "./onboard-auth.credentials.js";
|
||||||
@ -411,6 +417,75 @@ export function applyVeniceConfig(cfg: ClawdbotConfig): ClawdbotConfig {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function applyTogetherProviderConfig(cfg: ClawdbotConfig): ClawdbotConfig {
|
||||||
|
const models = { ...cfg.agents?.defaults?.models };
|
||||||
|
models[TOGETHER_DEFAULT_MODEL_REF] = {
|
||||||
|
...models[TOGETHER_DEFAULT_MODEL_REF],
|
||||||
|
alias: models[TOGETHER_DEFAULT_MODEL_REF]?.alias ?? "Together AI",
|
||||||
|
};
|
||||||
|
|
||||||
|
const providers = { ...cfg.models?.providers };
|
||||||
|
const existingProvider = providers.together;
|
||||||
|
const existingModels = Array.isArray(existingProvider?.models) ? existingProvider.models : [];
|
||||||
|
const togetherModels = TOGETHER_MODEL_CATALOG.map(buildTogetherModelDefinition);
|
||||||
|
const mergedModels = [
|
||||||
|
...existingModels,
|
||||||
|
...togetherModels.filter(
|
||||||
|
(model) => !existingModels.some((existing) => existing.id === model.id),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
const { apiKey: existingApiKey, ...existingProviderRest } = (existingProvider ?? {}) as Record<
|
||||||
|
string,
|
||||||
|
unknown
|
||||||
|
> as { apiKey?: string };
|
||||||
|
const resolvedApiKey = typeof existingApiKey === "string" ? existingApiKey : undefined;
|
||||||
|
const normalizedApiKey = resolvedApiKey?.trim();
|
||||||
|
providers.together = {
|
||||||
|
...existingProviderRest,
|
||||||
|
baseUrl: TOGETHER_BASE_URL,
|
||||||
|
api: "openai-completions",
|
||||||
|
...(normalizedApiKey ? { apiKey: normalizedApiKey } : {}),
|
||||||
|
models: mergedModels.length > 0 ? mergedModels : togetherModels,
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
...cfg,
|
||||||
|
agents: {
|
||||||
|
...cfg.agents,
|
||||||
|
defaults: {
|
||||||
|
...cfg.agents?.defaults,
|
||||||
|
models,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
models: {
|
||||||
|
mode: cfg.models?.mode ?? "merge",
|
||||||
|
providers,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function applyTogetherConfig(cfg: ClawdbotConfig): ClawdbotConfig {
|
||||||
|
const next = applyTogetherProviderConfig(cfg);
|
||||||
|
const existingModel = next.agents?.defaults?.model;
|
||||||
|
return {
|
||||||
|
...next,
|
||||||
|
agents: {
|
||||||
|
...next.agents,
|
||||||
|
defaults: {
|
||||||
|
...next.agents?.defaults,
|
||||||
|
model: {
|
||||||
|
...(existingModel && "fallbacks" in (existingModel as Record<string, unknown>)
|
||||||
|
? {
|
||||||
|
fallbacks: (existingModel as { fallbacks?: string[] }).fallbacks,
|
||||||
|
}
|
||||||
|
: undefined),
|
||||||
|
primary: TOGETHER_DEFAULT_MODEL_REF,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export function applyAuthProfileConfig(
|
export function applyAuthProfileConfig(
|
||||||
cfg: ClawdbotConfig,
|
cfg: ClawdbotConfig,
|
||||||
params: {
|
params: {
|
||||||
|
|||||||
@ -115,6 +115,7 @@ export async function setVeniceApiKey(key: string, agentDir?: string) {
|
|||||||
export const ZAI_DEFAULT_MODEL_REF = "zai/glm-4.7";
|
export const ZAI_DEFAULT_MODEL_REF = "zai/glm-4.7";
|
||||||
export const OPENROUTER_DEFAULT_MODEL_REF = "openrouter/auto";
|
export const OPENROUTER_DEFAULT_MODEL_REF = "openrouter/auto";
|
||||||
export const VERCEL_AI_GATEWAY_DEFAULT_MODEL_REF = "vercel-ai-gateway/anthropic/claude-opus-4.5";
|
export const VERCEL_AI_GATEWAY_DEFAULT_MODEL_REF = "vercel-ai-gateway/anthropic/claude-opus-4.5";
|
||||||
|
export const TOGETHER_DEFAULT_MODEL_REF = "together/meta-llama/Llama-3.3-70B-Instruct-Turbo";
|
||||||
|
|
||||||
export async function setZaiApiKey(key: string, agentDir?: string) {
|
export async function setZaiApiKey(key: string, agentDir?: string) {
|
||||||
// Write to resolved agent dir so gateway finds credentials on startup.
|
// Write to resolved agent dir so gateway finds credentials on startup.
|
||||||
@ -164,3 +165,15 @@ export async function setOpencodeZenApiKey(key: string, agentDir?: string) {
|
|||||||
agentDir: resolveAuthAgentDir(agentDir),
|
agentDir: resolveAuthAgentDir(agentDir),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function setTogetherApiKey(key: string, agentDir?: string) {
|
||||||
|
upsertAuthProfile({
|
||||||
|
profileId: "together:default",
|
||||||
|
credential: {
|
||||||
|
type: "api_key",
|
||||||
|
provider: "together",
|
||||||
|
key,
|
||||||
|
},
|
||||||
|
agentDir: resolveAuthAgentDir(agentDir),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@ -13,6 +13,8 @@ export {
|
|||||||
applyOpenrouterProviderConfig,
|
applyOpenrouterProviderConfig,
|
||||||
applySyntheticConfig,
|
applySyntheticConfig,
|
||||||
applySyntheticProviderConfig,
|
applySyntheticProviderConfig,
|
||||||
|
applyTogetherConfig,
|
||||||
|
applyTogetherProviderConfig,
|
||||||
applyVeniceConfig,
|
applyVeniceConfig,
|
||||||
applyVeniceProviderConfig,
|
applyVeniceProviderConfig,
|
||||||
applyVercelAiGatewayConfig,
|
applyVercelAiGatewayConfig,
|
||||||
@ -42,6 +44,7 @@ export {
|
|||||||
setOpencodeZenApiKey,
|
setOpencodeZenApiKey,
|
||||||
setOpenrouterApiKey,
|
setOpenrouterApiKey,
|
||||||
setSyntheticApiKey,
|
setSyntheticApiKey,
|
||||||
|
setTogetherApiKey,
|
||||||
setVeniceApiKey,
|
setVeniceApiKey,
|
||||||
setVercelAiGatewayApiKey,
|
setVercelAiGatewayApiKey,
|
||||||
setZaiApiKey,
|
setZaiApiKey,
|
||||||
@ -65,3 +68,10 @@ export {
|
|||||||
MOONSHOT_DEFAULT_MODEL_ID,
|
MOONSHOT_DEFAULT_MODEL_ID,
|
||||||
MOONSHOT_DEFAULT_MODEL_REF,
|
MOONSHOT_DEFAULT_MODEL_REF,
|
||||||
} from "./onboard-auth.models.js";
|
} from "./onboard-auth.models.js";
|
||||||
|
export {
|
||||||
|
buildTogetherModelDefinition,
|
||||||
|
TOGETHER_BASE_URL,
|
||||||
|
TOGETHER_DEFAULT_MODEL_ID,
|
||||||
|
TOGETHER_DEFAULT_MODEL_REF,
|
||||||
|
TOGETHER_MODEL_CATALOG,
|
||||||
|
} from "../agents/together-models.js";
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import {
|
|||||||
applyOpencodeZenConfig,
|
applyOpencodeZenConfig,
|
||||||
applyOpenrouterConfig,
|
applyOpenrouterConfig,
|
||||||
applySyntheticConfig,
|
applySyntheticConfig,
|
||||||
|
applyTogetherConfig,
|
||||||
applyVercelAiGatewayConfig,
|
applyVercelAiGatewayConfig,
|
||||||
applyZaiConfig,
|
applyZaiConfig,
|
||||||
setAnthropicApiKey,
|
setAnthropicApiKey,
|
||||||
@ -30,6 +31,7 @@ import {
|
|||||||
setOpencodeZenApiKey,
|
setOpencodeZenApiKey,
|
||||||
setOpenrouterApiKey,
|
setOpenrouterApiKey,
|
||||||
setSyntheticApiKey,
|
setSyntheticApiKey,
|
||||||
|
setTogetherApiKey,
|
||||||
setVercelAiGatewayApiKey,
|
setVercelAiGatewayApiKey,
|
||||||
setZaiApiKey,
|
setZaiApiKey,
|
||||||
} from "../../onboard-auth.js";
|
} from "../../onboard-auth.js";
|
||||||
@ -353,6 +355,25 @@ export async function applyNonInteractiveAuthChoice(params: {
|
|||||||
return applyOpencodeZenConfig(nextConfig);
|
return applyOpencodeZenConfig(nextConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (authChoice === "together-api-key") {
|
||||||
|
const resolved = await resolveNonInteractiveApiKey({
|
||||||
|
provider: "together",
|
||||||
|
cfg: baseConfig,
|
||||||
|
flagValue: opts.togetherApiKey,
|
||||||
|
flagName: "--together-api-key",
|
||||||
|
envVar: "TOGETHER_API_KEY",
|
||||||
|
runtime,
|
||||||
|
});
|
||||||
|
if (!resolved) return null;
|
||||||
|
if (resolved.source !== "profile") await setTogetherApiKey(resolved.key);
|
||||||
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
||||||
|
profileId: "together:default",
|
||||||
|
provider: "together",
|
||||||
|
mode: "api_key",
|
||||||
|
});
|
||||||
|
return applyTogetherConfig(nextConfig);
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
authChoice === "oauth" ||
|
authChoice === "oauth" ||
|
||||||
authChoice === "chutes" ||
|
authChoice === "chutes" ||
|
||||||
|
|||||||
@ -17,6 +17,7 @@ export type AuthChoice =
|
|||||||
| "kimi-code-api-key"
|
| "kimi-code-api-key"
|
||||||
| "synthetic-api-key"
|
| "synthetic-api-key"
|
||||||
| "venice-api-key"
|
| "venice-api-key"
|
||||||
|
| "together-api-key"
|
||||||
| "codex-cli"
|
| "codex-cli"
|
||||||
| "apiKey"
|
| "apiKey"
|
||||||
| "gemini-api-key"
|
| "gemini-api-key"
|
||||||
@ -70,6 +71,7 @@ export type OnboardOptions = {
|
|||||||
minimaxApiKey?: string;
|
minimaxApiKey?: string;
|
||||||
syntheticApiKey?: string;
|
syntheticApiKey?: string;
|
||||||
veniceApiKey?: string;
|
veniceApiKey?: string;
|
||||||
|
togetherApiKey?: string;
|
||||||
opencodeZenApiKey?: string;
|
opencodeZenApiKey?: string;
|
||||||
gatewayPort?: number;
|
gatewayPort?: number;
|
||||||
gatewayBind?: GatewayBind;
|
gatewayBind?: GatewayBind;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user