|
| 1 | +import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared"; |
1 | 2 | import type { ModelDefinitionConfig } from "openclaw/plugin-sdk/provider-model-shared"; |
| 3 | +import manifest from "./openclaw.plugin.json" with { type: "json" }; |
2 | 4 | |
3 | 5 | // ---------- TokenHub provider ---------- |
4 | 6 | |
5 | | -export const TOKENHUB_BASE_URL = "https://tokenhub.tencentmaas.com/v1"; |
6 | 7 | export const TOKENHUB_PROVIDER_ID = "tencent-tokenhub"; |
7 | 8 | |
8 | | -// Hy3 preview pricing ($ per 1M tokens), tiered by input context length. |
9 | | -// Flat rates mirror the first tier; tieredPricing drives actual cost calculation. |
10 | | -const HY3_PREVIEW_COST = { |
11 | | -input: 0.176, |
12 | | -output: 0.587, |
13 | | -cacheRead: 0.059, |
14 | | -cacheWrite: 0, |
15 | | -tieredPricing: [ |
16 | | -{ |
17 | | -input: 0.176, |
18 | | -output: 0.587, |
19 | | -cacheRead: 0.059, |
20 | | -cacheWrite: 0, |
21 | | -range: [0, 16_000] as [number, number], |
22 | | -}, |
23 | | -{ |
24 | | -input: 0.235, |
25 | | -output: 0.939, |
26 | | -cacheRead: 0.088, |
27 | | -cacheWrite: 0, |
28 | | -range: [16_000, 32_000] as [number, number], |
29 | | -}, |
30 | | -{ |
31 | | -input: 0.293, |
32 | | -output: 1.173, |
33 | | -cacheRead: 0.117, |
34 | | -cacheWrite: 0, |
35 | | -range: [32_000] as [number], |
36 | | -}, |
37 | | -], |
38 | | -}; |
| 9 | +const TOKENHUB_MANIFEST_PROVIDER = buildManifestModelProviderConfig({ |
| 10 | +providerId: TOKENHUB_PROVIDER_ID, |
| 11 | +catalog: manifest.modelCatalog.providers[TOKENHUB_PROVIDER_ID], |
| 12 | +}); |
39 | 13 | |
40 | | -export const TOKENHUB_MODEL_CATALOG: ModelDefinitionConfig[] = [ |
41 | | -{ |
42 | | -id: "hy3-preview", |
43 | | -name: "Hy3 preview (TokenHub)", |
44 | | -reasoning: true, |
45 | | -input: ["text"], |
46 | | -contextWindow: 256_000, |
47 | | -maxTokens: 64_000, |
48 | | -cost: HY3_PREVIEW_COST, |
49 | | -compat: { |
50 | | -supportsUsageInStreaming: true, |
51 | | -supportsReasoningEffort: true, |
52 | | -}, |
53 | | -}, |
54 | | -]; |
| 14 | +export const TOKENHUB_BASE_URL = TOKENHUB_MANIFEST_PROVIDER.baseUrl; |
| 15 | + |
| 16 | +export const TOKENHUB_MODEL_CATALOG: ModelDefinitionConfig[] = TOKENHUB_MANIFEST_PROVIDER.models; |
55 | 17 | |
56 | 18 | export function buildTokenHubModelDefinition( |
57 | 19 | model: (typeof TOKENHUB_MODEL_CATALOG)[number], |
|