Add Together AI model catalog and improve discovery formatting

This commit is contained in:
Riccardo Giorato 2026-01-27 13:32:12 +01:00
parent 90e1c4f801
commit f4745aa5e6
2 changed files with 22 additions and 7 deletions

View File

@ -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<ClawdbotConfig["models"]>;
export type ProviderConfig = NonNullable<ModelsConfig["providers"]>[string];
@ -362,7 +366,7 @@ async function buildOllamaProvider(): Promise<ProviderConfig> {
async function buildTogetherProvider(apiKey?: string): Promise<ProviderConfig> {
// 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<ProviderConfig | null> {
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 {

View File

@ -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",