diff --git a/extensions/byteplus/models.ts b/extensions/byteplus/models.ts index d43e28251f2..f400541849a 100644 --- a/extensions/byteplus/models.ts +++ b/extensions/byteplus/models.ts @@ -1,13 +1,19 @@ +import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared"; import type { ModelDefinitionConfig } from "openclaw/plugin-sdk/provider-model-shared"; -import { - buildVolcModelDefinition, - VOLC_MODEL_GLM_4_7, - VOLC_MODEL_KIMI_K2_5, - VOLC_SHARED_CODING_MODEL_CATALOG, -} from "openclaw/plugin-sdk/volc-model-catalog-shared"; +import manifest from "./openclaw.plugin.json" with { type: "json" }; -export const BYTEPLUS_BASE_URL = "https://ark.ap-southeast.bytepluses.com/api/v3"; -export const BYTEPLUS_CODING_BASE_URL = "https://ark.ap-southeast.bytepluses.com/api/coding/v3"; +const BYTEPLUS_MANIFEST_PROVIDER = buildManifestModelProviderConfig({ + providerId: "byteplus", + catalog: manifest.modelCatalog.providers.byteplus, +}); + +const BYTEPLUS_CODING_MANIFEST_PROVIDER = buildManifestModelProviderConfig({ + providerId: "byteplus-plan", + catalog: manifest.modelCatalog.providers["byteplus-plan"], +}); + +export const BYTEPLUS_BASE_URL = BYTEPLUS_MANIFEST_PROVIDER.baseUrl; +export const BYTEPLUS_CODING_BASE_URL = BYTEPLUS_CODING_MANIFEST_PROVIDER.baseUrl; export const BYTEPLUS_DEFAULT_MODEL_ID = "seed-1-8-251228"; export const BYTEPLUS_CODING_DEFAULT_MODEL_ID = "ark-code-latest"; export const BYTEPLUS_DEFAULT_MODEL_REF = `byteplus/${BYTEPLUS_DEFAULT_MODEL_ID}`; @@ -19,20 +25,9 @@ export const BYTEPLUS_DEFAULT_COST = { cacheWrite: 0, }; -export const BYTEPLUS_MODEL_CATALOG = [ - { - id: "seed-1-8-251228", - name: "Seed 1.8", - reasoning: false, - input: ["text", "image"] as const, - contextWindow: 256000, - maxTokens: 4096, - }, - VOLC_MODEL_KIMI_K2_5, - VOLC_MODEL_GLM_4_7, -] as const; - -export const BYTEPLUS_CODING_MODEL_CATALOG = VOLC_SHARED_CODING_MODEL_CATALOG; +export const BYTEPLUS_MODEL_CATALOG: ModelDefinitionConfig[] = BYTEPLUS_MANIFEST_PROVIDER.models; +export const BYTEPLUS_CODING_MODEL_CATALOG: ModelDefinitionConfig[] = + BYTEPLUS_CODING_MANIFEST_PROVIDER.models; export type BytePlusCatalogEntry = (typeof BYTEPLUS_MODEL_CATALOG)[number]; export type BytePlusCodingCatalogEntry = (typeof BYTEPLUS_CODING_MODEL_CATALOG)[number]; @@ -40,5 +35,9 @@ export type BytePlusCodingCatalogEntry = (typeof BYTEPLUS_CODING_MODEL_CATALOG)[ export function buildBytePlusModelDefinition( entry: BytePlusCatalogEntry | BytePlusCodingCatalogEntry, ): ModelDefinitionConfig { - return buildVolcModelDefinition(entry, BYTEPLUS_DEFAULT_COST); + return { + ...entry, + input: [...entry.input], + cost: { ...entry.cost }, + }; } diff --git a/extensions/byteplus/openclaw.plugin.json b/extensions/byteplus/openclaw.plugin.json index 7e6b1cd77bc..d4a8eeaede8 100644 --- a/extensions/byteplus/openclaw.plugin.json +++ b/extensions/byteplus/openclaw.plugin.json @@ -12,6 +12,130 @@ "providerAuthAliases": { "byteplus-plan": "byteplus" }, + "modelCatalog": { + "providers": { + "byteplus": { + "baseUrl": "https://ark.ap-southeast.bytepluses.com/api/v3", + "api": "openai-completions", + "models": [ + { + "id": "seed-1-8-251228", + "name": "Seed 1.8", + "input": ["text", "image"], + "contextWindow": 256000, + "maxTokens": 4096, + "cost": { + "input": 0.0001, + "output": 0.0002, + "cacheRead": 0, + "cacheWrite": 0 + } + }, + { + "id": "kimi-k2-5-260127", + "name": "Kimi K2.5", + "input": ["text", "image"], + "contextWindow": 256000, + "maxTokens": 4096, + "cost": { + "input": 0.0001, + "output": 0.0002, + "cacheRead": 0, + "cacheWrite": 0 + } + }, + { + "id": "glm-4-7-251222", + "name": "GLM 4.7", + "input": ["text", "image"], + "contextWindow": 200000, + "maxTokens": 4096, + "cost": { + "input": 0.0001, + "output": 0.0002, + "cacheRead": 0, + "cacheWrite": 0 + } + } + ] + }, + "byteplus-plan": { + "baseUrl": "https://ark.ap-southeast.bytepluses.com/api/coding/v3", + "api": "openai-completions", + "models": [ + { + "id": "ark-code-latest", + "name": "Ark Coding Plan", + "input": ["text"], + "contextWindow": 256000, + "maxTokens": 4096, + "cost": { + "input": 0.0001, + "output": 0.0002, + "cacheRead": 0, + "cacheWrite": 0 + } + }, + { + "id": "doubao-seed-code", + "name": "Doubao Seed Code", + "input": ["text"], + "contextWindow": 256000, + "maxTokens": 4096, + "cost": { + "input": 0.0001, + "output": 0.0002, + "cacheRead": 0, + "cacheWrite": 0 + } + }, + { + "id": "glm-4.7", + "name": "GLM 4.7 Coding", + "input": ["text"], + "contextWindow": 200000, + "maxTokens": 4096, + "cost": { + "input": 0.0001, + "output": 0.0002, + "cacheRead": 0, + "cacheWrite": 0 + } + }, + { + "id": "kimi-k2-thinking", + "name": "Kimi K2 Thinking", + "input": ["text"], + "contextWindow": 256000, + "maxTokens": 4096, + "cost": { + "input": 0.0001, + "output": 0.0002, + "cacheRead": 0, + "cacheWrite": 0 + } + }, + { + "id": "kimi-k2.5", + "name": "Kimi K2.5 Coding", + "input": ["text"], + "contextWindow": 256000, + "maxTokens": 4096, + "cost": { + "input": 0.0001, + "output": 0.0002, + "cacheRead": 0, + "cacheWrite": 0 + } + } + ] + } + }, + "discovery": { + "byteplus": "static", + "byteplus-plan": "static" + } + }, "providerAuthChoices": [ { "provider": "byteplus", diff --git a/extensions/byteplus/provider-catalog.ts b/extensions/byteplus/provider-catalog.ts index 396fc2ca8ed..401b5dd6874 100644 --- a/extensions/byteplus/provider-catalog.ts +++ b/extensions/byteplus/provider-catalog.ts @@ -1,24 +1,17 @@ +import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared"; import type { ModelProviderConfig } from "openclaw/plugin-sdk/provider-model-shared"; -import { - buildBytePlusModelDefinition, - BYTEPLUS_BASE_URL, - BYTEPLUS_CODING_BASE_URL, - BYTEPLUS_CODING_MODEL_CATALOG, - BYTEPLUS_MODEL_CATALOG, -} from "./models.js"; +import manifest from "./openclaw.plugin.json" with { type: "json" }; export function buildBytePlusProvider(): ModelProviderConfig { - return { - baseUrl: BYTEPLUS_BASE_URL, - api: "openai-completions", - models: BYTEPLUS_MODEL_CATALOG.map(buildBytePlusModelDefinition), - }; + return buildManifestModelProviderConfig({ + providerId: "byteplus", + catalog: manifest.modelCatalog.providers.byteplus, + }); } export function buildBytePlusCodingProvider(): ModelProviderConfig { - return { - baseUrl: BYTEPLUS_CODING_BASE_URL, - api: "openai-completions", - models: BYTEPLUS_CODING_MODEL_CATALOG.map(buildBytePlusModelDefinition), - }; + return buildManifestModelProviderConfig({ + providerId: "byteplus-plan", + catalog: manifest.modelCatalog.providers["byteplus-plan"], + }); }