From f4745aa5e678610f836b3a47eb87a04ef1390fdd Mon Sep 17 00:00:00 2001 From: Riccardo Giorato Date: Tue, 27 Jan 2026 13:32:12 +0100 Subject: [PATCH] Add Together AI model catalog and improve discovery formatting --- src/agents/models-config.providers.ts | 27 +++++++++++++++++++++------ src/agents/together-models.ts | 2 +- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/agents/models-config.providers.ts b/src/agents/models-config.providers.ts index 87c0042f6..ae56e896e 100644 --- a/src/agents/models-config.providers.ts +++ b/src/agents/models-config.providers.ts @@ -13,7 +13,11 @@ import { SYNTHETIC_MODEL_CATALOG, } from "./synthetic-models.js"; import { discoverVeniceModels, VENICE_BASE_URL } from "./venice-models.js"; -import { discoverTogetherModels, TOGETHER_BASE_URL } from "./together-models.js"; +import { + discoverTogetherModels, + TOGETHER_BASE_URL, + TOGETHER_MODEL_CATALOG, +} from "./together-models.js"; type ModelsConfig = NonNullable; export type ProviderConfig = NonNullable[string]; @@ -362,7 +366,7 @@ async function buildOllamaProvider(): Promise { async function buildTogetherProvider(apiKey?: string): Promise { // Only discover models if we have an API key, otherwise use static catalog - const models = apiKey ? await discoverTogetherModels(apiKey) : []; + const models = apiKey ? await discoverTogetherModels(apiKey) : TOGETHER_MODEL_CATALOG; // If we successfully discovered models, return them and let the merge logic handle conflicts // If discovery failed, return empty array to fallback to static catalog @@ -399,7 +403,10 @@ export async function resolveImplicitProviders(params: { resolveEnvApiKeyVarName("kimi-code") ?? resolveApiKeyFromProfiles({ provider: "kimi-code", store: authStore }); if (kimiCodeKey) { - providers["kimi-code"] = { ...buildKimiCodeProvider(), apiKey: kimiCodeKey }; + providers["kimi-code"] = { + ...buildKimiCodeProvider(), + apiKey: kimiCodeKey, + }; } const syntheticKey = @@ -436,7 +443,10 @@ export async function resolveImplicitProviders(params: { resolveEnvApiKeyVarName("together") ?? resolveApiKeyFromProfiles({ provider: "together", store: authStore }); if (togetherKey) { - providers.together = { ...(await buildTogetherProvider(togetherKey)), apiKey: togetherKey }; + providers.together = { + ...(await buildTogetherProvider(togetherKey)), + apiKey: togetherKey, + }; } return providers; @@ -447,7 +457,9 @@ export async function resolveImplicitCopilotProvider(params: { env?: NodeJS.ProcessEnv; }): Promise { const env = params.env ?? process.env; - const authStore = ensureAuthProfileStore(params.agentDir, { allowKeychainPrompt: false }); + const authStore = ensureAuthProfileStore(params.agentDir, { + allowKeychainPrompt: false, + }); const hasProfile = listProfilesForProvider(authStore, "github-copilot").length > 0; const envToken = env.COPILOT_GITHUB_TOKEN ?? env.GH_TOKEN ?? env.GITHUB_TOKEN; const githubToken = (envToken ?? "").trim(); @@ -512,7 +524,10 @@ export async function resolveImplicitBedrockProvider(params: { if (enabled !== true && !hasAwsCreds) return null; const region = discoveryConfig?.region ?? env.AWS_REGION ?? env.AWS_DEFAULT_REGION ?? "us-east-1"; - const models = await discoverBedrockModels({ region, config: discoveryConfig }); + const models = await discoverBedrockModels({ + region, + config: discoveryConfig, + }); if (models.length === 0) return null; return { diff --git a/src/agents/together-models.ts b/src/agents/together-models.ts index 8b82d138d..c3d207d8f 100644 --- a/src/agents/together-models.ts +++ b/src/agents/together-models.ts @@ -11,7 +11,7 @@ export const TOGETHER_DEFAULT_COST = { cacheWrite: 0.5, }; -export const TOGETHER_MODEL_CATALOG = [ +export const TOGETHER_MODEL_CATALOG: ModelDefinitionConfig[] = [ { id: "zai-org/GLM-4.7", name: "GLM 4.7 Fp8",