@acedatacloud/openclaw-provider 2026.5.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +80 -0
- package/dist/src/chat/generated-catalog.d.ts +9 -0
- package/dist/src/chat/generated-catalog.js +67 -0
- package/dist/src/chat/onboard.d.ts +5 -0
- package/dist/src/chat/onboard.js +23 -0
- package/dist/src/chat/provider-catalog.d.ts +4 -0
- package/dist/src/chat/provider-catalog.js +62 -0
- package/dist/src/constants.d.ts +3 -0
- package/dist/src/constants.js +3 -0
- package/dist/src/search/acedata-search-client.d.ts +35 -0
- package/dist/src/search/acedata-search-client.js +112 -0
- package/dist/src/search/acedata-search-config.d.ts +11 -0
- package/dist/src/search/acedata-search-config.js +45 -0
- package/dist/src/search/acedata-search-provider.d.ts +2 -0
- package/dist/src/search/acedata-search-provider.js +73 -0
- package/dist/src/search/acedata-search-shared.d.ts +3 -0
- package/dist/src/search/acedata-search-shared.js +23 -0
- package/index.ts +98 -0
- package/openclaw.plugin.json +77 -0
- package/package.json +97 -0
- package/src/chat/generated-catalog.ts +77 -0
- package/src/chat/model-overrides.json +93 -0
- package/src/chat/onboard.ts +33 -0
- package/src/chat/provider-catalog.ts +73 -0
- package/src/constants.ts +3 -0
- package/src/search/acedata-search-client.ts +160 -0
- package/src/search/acedata-search-config.ts +76 -0
- package/src/search/acedata-search-provider.ts +80 -0
- package/src/search/acedata-search-shared.ts +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ace Data Cloud
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# `@acedatacloud/openclaw-provider`
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@acedatacloud/openclaw-provider)
|
|
4
|
+
[](https://github.com/AceDataCloud/OpenClawProvider/actions/workflows/ci.yml)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
An [OpenClaw](https://github.com/openclaw/openclaw) provider plugin that surfaces the entire **Ace Data Cloud** AI stack — **chat, image generation, video generation, music generation, and web search** — through a single OpenAI-compatible endpoint.
|
|
8
|
+
|
|
9
|
+
> 50+ LLMs (Claude, GPT, Gemini, Grok, DeepSeek, Kimi, GLM, Qwen, …) **+** Midjourney, Flux, Seedream, NanoBanana, gpt-image-2 **+** Sora, Veo, Kling, Luma, Hailuo, Wan, Seedance, Pixverse **+** Suno, Producer **+** Google Web Search. One plugin, one API key.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
openclaw plugins install npm:@acedatacloud/openclaw-provider
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Then run onboarding:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
openclaw onboard --auth-choice acedatacloud-api-key --acedata-api-key <YOUR_KEY>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Get a key at [`platform.acedata.cloud/console/applications`](https://platform.acedata.cloud/console/applications) — first credentials include free credits.
|
|
24
|
+
|
|
25
|
+
## What you get in v2026.5.31
|
|
26
|
+
|
|
27
|
+
| Capability | Status | Notes |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| **Chat** | ✅ shipping | 62 curated models (Claude opus/sonnet/haiku, GPT-4.1/4o/5.x, o-series, Gemini 3.x, Grok 4, DeepSeek V3/R1/V4, Kimi K2, GLM 5) — plus any model id you pass through (e.g. `acedatacloud/gpt-5.4-mini`) via `resolveDynamicModel` |
|
|
30
|
+
| **Web Search** | ✅ shipping | Google SERP — supports `search` / `images` / `news` / `videos` / `maps` / `places` verticals |
|
|
31
|
+
| **Image generation** | 🚧 follow-up PR | Midjourney, Flux dev/pro/kontext, Seedream 4 / 4.5, NanoBanana / NanoBanana Pro, `gpt-image-2` — currently exposed via chat-style passthrough; native `ImageGenerationProvider` is planned |
|
|
32
|
+
| **Video generation** | 🚧 follow-up PR | Sora, Veo 3 / 3.1-fast, Kling 2.1, Luma Ray 2, Hailuo 02, Wan 2.5, Seedance 1 Pro, Pixverse 4.5 — needs an async task-polling adapter |
|
|
33
|
+
| **Music generation** | 🚧 follow-up PR | Suno v5, Producer — needs an async task-polling adapter |
|
|
34
|
+
|
|
35
|
+
## Status
|
|
36
|
+
|
|
37
|
+
**v2026.5.31 (first npm release).** Chat (62 models, dynamic-id passthrough) and web search are shipping. Image / video / music modality providers are tracked as follow-ups — see the [PR board](https://github.com/AceDataCloud/OpenClawProvider/pulls) and the [plan](https://github.com/AceDataCloud/Index/blob/main/.plans/OPENCLAW-PROVIDER.md).
|
|
38
|
+
|
|
39
|
+
## Configuration
|
|
40
|
+
|
|
41
|
+
Set either env var (OpenClaw reads both):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
export ACEDATA_API_KEY="..."
|
|
45
|
+
# or
|
|
46
|
+
export ACEDATACLOUD_API_KEY="..."
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Or pass `--acedata-api-key <key>` on the CLI.
|
|
50
|
+
|
|
51
|
+
## Billing
|
|
52
|
+
|
|
53
|
+
Billing is computed on the Ace Data Cloud platform side (per-request credits). To avoid double-estimation, this plugin reports `cost: 0` in OpenClaw's model catalog — see your real usage at [`platform.acedata.cloud/console/usages`](https://platform.acedata.cloud/console/usages).
|
|
54
|
+
|
|
55
|
+
## Development
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Clone next to a checkout of openclaw/openclaw (we use its workspace SDK)
|
|
59
|
+
git clone https://github.com/openclaw/openclaw.git ../openclaw
|
|
60
|
+
git clone https://github.com/AceDataCloud/OpenClawProvider.git
|
|
61
|
+
cd OpenClawProvider
|
|
62
|
+
pnpm install # or npm install
|
|
63
|
+
pnpm test # vitest unit
|
|
64
|
+
pnpm build # tsc -> dist/
|
|
65
|
+
pnpm test:live # requires ACEDATA_API_KEY in env, real api.acedata.cloud calls
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Contributing
|
|
69
|
+
|
|
70
|
+
PRs welcome. Please open an issue first for non-trivial changes. See [CONTRIBUTING](.github/CONTRIBUTING.md) (TBD).
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
[MIT](LICENSE) © Ace Data Cloud
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
configSchema: import("openclaw/plugin-sdk/plugin-entry").OpenClawPluginConfigSchema;
|
|
6
|
+
register: NonNullable<import("openclaw/plugin-sdk/plugin-entry").OpenClawPluginDefinition["register"]>;
|
|
7
|
+
} & Pick<import("openclaw/plugin-sdk/plugin-entry").OpenClawPluginDefinition, "kind" | "reload" | "nodeHostCommands" | "securityAuditCollectors">;
|
|
8
|
+
export default _default;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
2
|
+
import { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-auth-api-key";
|
|
3
|
+
import { ACEDATA_BASE_URL, ACEDATA_PROVIDER_ID, } from "./src/constants.js";
|
|
4
|
+
import { buildAcedataChatProvider, isAcedataReasoningModel, } from "./src/chat/provider-catalog.js";
|
|
5
|
+
import { ACEDATA_DEFAULT_MODEL_REF, applyAcedataConfig, } from "./src/chat/onboard.js";
|
|
6
|
+
import { createAcedataWebSearchProvider } from "./src/search/acedata-search-provider.js";
|
|
7
|
+
const ZERO_COST = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
|
8
|
+
function resolveDynamicChatModel(ctx) {
|
|
9
|
+
return {
|
|
10
|
+
id: ctx.modelId,
|
|
11
|
+
name: ctx.modelId,
|
|
12
|
+
api: "openai-completions",
|
|
13
|
+
provider: ACEDATA_PROVIDER_ID,
|
|
14
|
+
baseUrl: ACEDATA_BASE_URL,
|
|
15
|
+
reasoning: isAcedataReasoningModel(ctx.modelId),
|
|
16
|
+
input: ["text", "image"],
|
|
17
|
+
cost: ZERO_COST,
|
|
18
|
+
contextWindow: 128_000,
|
|
19
|
+
maxTokens: 8_192,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export default definePluginEntry({
|
|
23
|
+
id: ACEDATA_PROVIDER_ID,
|
|
24
|
+
name: "Ace Data Cloud Provider",
|
|
25
|
+
description: "Bundled Ace Data Cloud provider plugin (chat, image, video, music, search)",
|
|
26
|
+
register(api) {
|
|
27
|
+
api.registerProvider({
|
|
28
|
+
id: ACEDATA_PROVIDER_ID,
|
|
29
|
+
label: "Ace Data Cloud",
|
|
30
|
+
docsPath: "/providers/acedatacloud",
|
|
31
|
+
envVars: ["ACEDATA_API_KEY", "ACEDATACLOUD_API_KEY"],
|
|
32
|
+
auth: [
|
|
33
|
+
createProviderApiKeyAuthMethod({
|
|
34
|
+
providerId: ACEDATA_PROVIDER_ID,
|
|
35
|
+
methodId: "api-key",
|
|
36
|
+
label: "Ace Data Cloud API key",
|
|
37
|
+
hint: "API key from https://platform.acedata.cloud/console/applications",
|
|
38
|
+
optionKey: "acedatacloudApiKey",
|
|
39
|
+
flagName: "--acedata-api-key",
|
|
40
|
+
envVar: "ACEDATA_API_KEY",
|
|
41
|
+
promptMessage: "Enter your Ace Data Cloud API key",
|
|
42
|
+
defaultModel: ACEDATA_DEFAULT_MODEL_REF,
|
|
43
|
+
expectedProviders: [ACEDATA_PROVIDER_ID],
|
|
44
|
+
applyConfig: (cfg) => applyAcedataConfig(cfg),
|
|
45
|
+
wizard: {
|
|
46
|
+
choiceId: "acedatacloud-api-key",
|
|
47
|
+
choiceLabel: "Ace Data Cloud API key",
|
|
48
|
+
groupId: ACEDATA_PROVIDER_ID,
|
|
49
|
+
groupLabel: "Ace Data Cloud",
|
|
50
|
+
groupHint: "API key",
|
|
51
|
+
onboardingScopes: ["text-inference"],
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
],
|
|
55
|
+
catalog: {
|
|
56
|
+
order: "simple",
|
|
57
|
+
run: async (ctx) => {
|
|
58
|
+
const apiKey = ctx.resolveProviderApiKey(ACEDATA_PROVIDER_ID).apiKey;
|
|
59
|
+
if (!apiKey) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
provider: {
|
|
64
|
+
...buildAcedataChatProvider(),
|
|
65
|
+
apiKey,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
staticCatalog: {
|
|
71
|
+
order: "simple",
|
|
72
|
+
run: async () => ({
|
|
73
|
+
provider: buildAcedataChatProvider(),
|
|
74
|
+
}),
|
|
75
|
+
},
|
|
76
|
+
resolveDynamicModel: (ctx) => resolveDynamicChatModel(ctx),
|
|
77
|
+
});
|
|
78
|
+
api.registerWebSearchProvider(createAcedataWebSearchProvider());
|
|
79
|
+
},
|
|
80
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/sync-catalog.mjs. DO NOT EDIT.
|
|
2
|
+
// Run: pnpm sync-catalog
|
|
3
|
+
// Source: PlatformBackend/cost/api/_chat_models.json
|
|
4
|
+
export const GENERATED_CHAT_MODELS = [
|
|
5
|
+
{ id: "claude-sonnet-4-6", name: "Claude Sonnet 4.6", reasoning: true, vision: true, contextWindow: 1000000, maxTokens: 128000 },
|
|
6
|
+
{ id: "claude-sonnet-4-5-20250929", name: "Claude Sonnet 4.5", reasoning: true, vision: true, contextWindow: 1000000, maxTokens: 64000 },
|
|
7
|
+
{ id: "claude-sonnet-4-20250514", name: "Claude Sonnet 4", reasoning: true, vision: true, contextWindow: 200000, maxTokens: 64000 },
|
|
8
|
+
{ id: "claude-opus-4-8", name: "Claude Opus 4.8", reasoning: true, vision: true, contextWindow: 1000000, maxTokens: 128000 },
|
|
9
|
+
{ id: "claude-opus-4-7", name: "Claude Opus 4.7", reasoning: true, vision: true, contextWindow: 1000000, maxTokens: 128000 },
|
|
10
|
+
{ id: "claude-opus-4-6", name: "Claude Opus 4.6", reasoning: true, vision: true, contextWindow: 1000000, maxTokens: 128000 },
|
|
11
|
+
{ id: "claude-opus-4-5-20251101", name: "Claude Opus 4.5", reasoning: true, vision: true, contextWindow: 200000, maxTokens: 64000 },
|
|
12
|
+
{ id: "claude-opus-4-20250514", name: "Claude Opus 4", reasoning: true, vision: true, contextWindow: 200000, maxTokens: 32000 },
|
|
13
|
+
{ id: "claude-opus-4-1-20250805", name: "Claude Opus 4.1", reasoning: true, vision: true, contextWindow: 200000, maxTokens: 32000 },
|
|
14
|
+
{ id: "claude-haiku-4-5-20251001", name: "Claude Haiku 4.5", reasoning: false, vision: true, contextWindow: 200000, maxTokens: 8192 },
|
|
15
|
+
{ id: "claude-3-opus-20240229", name: "Claude 3 Opus", reasoning: false, vision: true, contextWindow: 200000, maxTokens: 4096 },
|
|
16
|
+
{ id: "claude-3-7-sonnet-20250219", name: "Claude 3.7 Sonnet", reasoning: true, vision: true, contextWindow: 200000, maxTokens: 64000 },
|
|
17
|
+
{ id: "claude-3-5-sonnet-20241022", name: "Claude 3.5 Sonnet", reasoning: false, vision: true, contextWindow: 200000, maxTokens: 8192 },
|
|
18
|
+
{ id: "claude-3-5-haiku-20241022", name: "Claude 3.5 Haiku", reasoning: false, vision: true, contextWindow: 200000, maxTokens: 8192 },
|
|
19
|
+
{ id: "gpt-5.4-nano", name: "GPT-5.4 nano", reasoning: true, vision: true, contextWindow: 400000, maxTokens: 16384 },
|
|
20
|
+
{ id: "gpt-5.4-mini", name: "GPT-5.4 mini", reasoning: true, vision: true, contextWindow: 400000, maxTokens: 16384 },
|
|
21
|
+
{ id: "gpt-5.2-pro", name: "GPT-5.2 Pro", reasoning: true, vision: true, contextWindow: 400000, maxTokens: 32768 },
|
|
22
|
+
{ id: "gpt-5.1-all", name: "GPT-5.1 all", reasoning: true, vision: true, contextWindow: 400000, maxTokens: 16384 },
|
|
23
|
+
{ id: "gpt-5-all", name: "GPT-5 all", reasoning: true, vision: true, contextWindow: 400000, maxTokens: 16384 },
|
|
24
|
+
{ id: "gpt-4o-mini", name: "GPT-4o mini", reasoning: false, vision: true, contextWindow: 128000, maxTokens: 16384 },
|
|
25
|
+
{ id: "gpt-4o-image", name: "GPT-4o image", reasoning: false, vision: true, contextWindow: 128000, maxTokens: 16384 },
|
|
26
|
+
{ id: "gpt-4o-all", name: "GPT-4o all", reasoning: false, vision: true, contextWindow: 128000, maxTokens: 16384 },
|
|
27
|
+
{ id: "gpt-4o", name: "GPT-4o", reasoning: false, vision: true, contextWindow: 128000, maxTokens: 16384 },
|
|
28
|
+
{ id: "gpt-4.1-nano", name: "GPT-4.1 nano", reasoning: false, vision: true, contextWindow: 1000000, maxTokens: 32768 },
|
|
29
|
+
{ id: "gpt-4.1-mini", name: "GPT-4.1 mini", reasoning: false, vision: true, contextWindow: 1000000, maxTokens: 32768 },
|
|
30
|
+
{ id: "gpt-4.1", name: "GPT-4.1", reasoning: false, vision: true, contextWindow: 1000000, maxTokens: 32768 },
|
|
31
|
+
{ id: "o4-mini", name: "o4 mini", reasoning: true, vision: true, contextWindow: 200000, maxTokens: 100000 },
|
|
32
|
+
{ id: "o3-pro", name: "o3 pro", reasoning: true, vision: true, contextWindow: 200000, maxTokens: 100000 },
|
|
33
|
+
{ id: "o3-mini", name: "o3 mini", reasoning: true, vision: false, contextWindow: 200000, maxTokens: 100000 },
|
|
34
|
+
{ id: "o3", name: "o3", reasoning: true, vision: true, contextWindow: 200000, maxTokens: 100000 },
|
|
35
|
+
{ id: "o1-pro", name: "o1 pro", reasoning: true, vision: true, contextWindow: 200000, maxTokens: 100000 },
|
|
36
|
+
{ id: "o1-mini", name: "o1 mini", reasoning: true, vision: false, contextWindow: 128000, maxTokens: 65536 },
|
|
37
|
+
{ id: "o1", name: "o1", reasoning: true, vision: true, contextWindow: 200000, maxTokens: 100000 },
|
|
38
|
+
{ id: "gemini-3.1-pro", name: "Gemini 3.1 Pro", reasoning: true, vision: true, contextWindow: 2000000, maxTokens: 65536 },
|
|
39
|
+
{ id: "gemini-3.1-flash-lite-preview", name: "Gemini 3.1 Flash Lite (preview)", reasoning: false, vision: true, contextWindow: 1000000, maxTokens: 65536 },
|
|
40
|
+
{ id: "gemini-3.1-flash-image-preview", name: "Gemini 3.1 Flash Image (preview)", reasoning: false, vision: true, contextWindow: 1000000, maxTokens: 65536 },
|
|
41
|
+
{ id: "gemini-3-pro-preview", name: "Gemini 3 Pro (preview)", reasoning: true, vision: true, contextWindow: 2000000, maxTokens: 65536 },
|
|
42
|
+
{ id: "grok-4-1-fast-reasoning", name: "Grok 4.1 Fast (reasoning)", reasoning: true, vision: true, contextWindow: 256000, maxTokens: 16384 },
|
|
43
|
+
{ id: "grok-4-1-fast-non-reasoning", name: "Grok 4.1 Fast (non-reasoning)", reasoning: false, vision: true, contextWindow: 256000, maxTokens: 16384 },
|
|
44
|
+
{ id: "grok-4-1-fast", name: "Grok 4.1 Fast", reasoning: false, vision: true, contextWindow: 256000, maxTokens: 16384 },
|
|
45
|
+
{ id: "grok-4", name: "Grok 4", reasoning: true, vision: true, contextWindow: 256000, maxTokens: 16384 },
|
|
46
|
+
{ id: "grok-3-mini-fast", name: "Grok 3 mini Fast", reasoning: false, vision: true, contextWindow: 128000, maxTokens: 8192 },
|
|
47
|
+
{ id: "grok-3-mini", name: "Grok 3 mini", reasoning: false, vision: true, contextWindow: 128000, maxTokens: 8192 },
|
|
48
|
+
{ id: "grok-3-fast", name: "Grok 3 Fast", reasoning: false, vision: true, contextWindow: 128000, maxTokens: 8192 },
|
|
49
|
+
{ id: "grok-3", name: "Grok 3", reasoning: false, vision: true, contextWindow: 128000, maxTokens: 8192 },
|
|
50
|
+
{ id: "deepseek-v4-flash", name: "DeepSeek V4 Flash", reasoning: true, vision: false, contextWindow: 128000, maxTokens: 8192 },
|
|
51
|
+
{ id: "deepseek-v3.2-exp", name: "DeepSeek V3.2 (exp)", reasoning: false, vision: false, contextWindow: 128000, maxTokens: 8192 },
|
|
52
|
+
{ id: "deepseek-v3", name: "DeepSeek V3", reasoning: false, vision: false, contextWindow: 128000, maxTokens: 8192 },
|
|
53
|
+
{ id: "deepseek-reasoner", name: "DeepSeek Reasoner", reasoning: true, vision: false, contextWindow: 128000, maxTokens: 8192 },
|
|
54
|
+
{ id: "deepseek-r1", name: "DeepSeek R1", reasoning: true, vision: false, contextWindow: 128000, maxTokens: 8192 },
|
|
55
|
+
{ id: "kimi-k2.5", name: "Kimi K2.5", reasoning: true, vision: true, contextWindow: 262144, maxTokens: 16384 },
|
|
56
|
+
{ id: "kimi-k2-turbo-preview", name: "Kimi K2 Turbo (preview)", reasoning: false, vision: false, contextWindow: 200000, maxTokens: 8192 },
|
|
57
|
+
{ id: "kimi-k2-thinking-turbo", name: "Kimi K2 Thinking Turbo", reasoning: true, vision: false, contextWindow: 200000, maxTokens: 16384 },
|
|
58
|
+
{ id: "kimi-k2-thinking", name: "Kimi K2 Thinking", reasoning: true, vision: false, contextWindow: 200000, maxTokens: 16384 },
|
|
59
|
+
{ id: "kimi-k2-instruct-0905", name: "Kimi K2 Instruct (0905)", reasoning: false, vision: false, contextWindow: 200000, maxTokens: 8192 },
|
|
60
|
+
{ id: "glm-5.1", name: "GLM 5.1", reasoning: true, vision: true, contextWindow: 128000, maxTokens: 8192 },
|
|
61
|
+
{ id: "glm-5-turbo", name: "GLM 5 Turbo", reasoning: false, vision: true, contextWindow: 128000, maxTokens: 8192 },
|
|
62
|
+
{ id: "glm-5", name: "GLM 5", reasoning: true, vision: true, contextWindow: 128000, maxTokens: 8192 },
|
|
63
|
+
{ id: "glm-4.7", name: "GLM 4.7", reasoning: false, vision: true, contextWindow: 128000, maxTokens: 8192 },
|
|
64
|
+
{ id: "glm-4.6", name: "GLM 4.6", reasoning: false, vision: true, contextWindow: 128000, maxTokens: 8192 },
|
|
65
|
+
{ id: "glm-4.5v", name: "GLM 4.5V", reasoning: false, vision: true, contextWindow: 128000, maxTokens: 8192 },
|
|
66
|
+
{ id: "glm-4.5", name: "GLM 4.5", reasoning: false, vision: true, contextWindow: 128000, maxTokens: 8192 },
|
|
67
|
+
];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type OpenClawConfig } from "openclaw/plugin-sdk/provider-onboard";
|
|
2
|
+
import { ACEDATA_DEFAULT_MODEL_REF } from "../constants.js";
|
|
3
|
+
export { ACEDATA_DEFAULT_MODEL_REF };
|
|
4
|
+
export declare function applyAcedataProviderConfig(cfg: OpenClawConfig): OpenClawConfig;
|
|
5
|
+
export declare function applyAcedataConfig(cfg: OpenClawConfig): OpenClawConfig;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { applyAgentDefaultModelPrimary, } from "openclaw/plugin-sdk/provider-onboard";
|
|
2
|
+
import { ACEDATA_DEFAULT_MODEL_REF } from "../constants.js";
|
|
3
|
+
export { ACEDATA_DEFAULT_MODEL_REF };
|
|
4
|
+
export function applyAcedataProviderConfig(cfg) {
|
|
5
|
+
const models = { ...cfg.agents?.defaults?.models };
|
|
6
|
+
models[ACEDATA_DEFAULT_MODEL_REF] = {
|
|
7
|
+
...models[ACEDATA_DEFAULT_MODEL_REF],
|
|
8
|
+
alias: models[ACEDATA_DEFAULT_MODEL_REF]?.alias ?? "Ace Data Cloud",
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
...cfg,
|
|
12
|
+
agents: {
|
|
13
|
+
...cfg.agents,
|
|
14
|
+
defaults: {
|
|
15
|
+
...cfg.agents?.defaults,
|
|
16
|
+
models,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export function applyAcedataConfig(cfg) {
|
|
22
|
+
return applyAgentDefaultModelPrimary(applyAcedataProviderConfig(cfg), ACEDATA_DEFAULT_MODEL_REF);
|
|
23
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ModelDefinitionConfig, ModelProviderConfig } from "openclaw/plugin-sdk/provider-model-shared";
|
|
2
|
+
export declare function isAcedataReasoningModel(modelId: string): boolean;
|
|
3
|
+
export declare function listAcedataChatModels(): ModelDefinitionConfig[];
|
|
4
|
+
export declare function buildAcedataChatProvider(): ModelProviderConfig;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ACEDATA_BASE_URL } from "../constants.js";
|
|
2
|
+
import { GENERATED_CHAT_MODELS } from "./generated-catalog.js";
|
|
3
|
+
const ZERO_COST = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
|
4
|
+
const CATALOG_REASONING_BY_ID = new Map(GENERATED_CHAT_MODELS.map((m) => [m.id.toLowerCase(), m.reasoning]));
|
|
5
|
+
// Heuristic fallback for ids NOT in the curated catalog (used by
|
|
6
|
+
// resolveDynamicModel passthrough). Authoritative source: catalog lookup above.
|
|
7
|
+
const REASONING_HEURISTIC_PREFIXES = [
|
|
8
|
+
"gpt-5",
|
|
9
|
+
"claude-opus-",
|
|
10
|
+
"claude-sonnet-4",
|
|
11
|
+
"claude-3-7-sonnet",
|
|
12
|
+
"gemini-3.1-pro",
|
|
13
|
+
"gemini-3-pro",
|
|
14
|
+
"grok-4",
|
|
15
|
+
"deepseek-r",
|
|
16
|
+
"deepseek-v4",
|
|
17
|
+
"deepseek-reasoner",
|
|
18
|
+
"kimi-k2-thinking",
|
|
19
|
+
"kimi-k2.5",
|
|
20
|
+
"glm-5",
|
|
21
|
+
];
|
|
22
|
+
const REASONING_HEURISTIC_EXACT = new Set([
|
|
23
|
+
"o1",
|
|
24
|
+
"o1-mini",
|
|
25
|
+
"o1-pro",
|
|
26
|
+
"o3",
|
|
27
|
+
"o3-mini",
|
|
28
|
+
"o3-pro",
|
|
29
|
+
"o4-mini",
|
|
30
|
+
]);
|
|
31
|
+
export function isAcedataReasoningModel(modelId) {
|
|
32
|
+
const normalized = modelId.trim().toLowerCase();
|
|
33
|
+
if (!normalized)
|
|
34
|
+
return false;
|
|
35
|
+
const fromCatalog = CATALOG_REASONING_BY_ID.get(normalized);
|
|
36
|
+
if (fromCatalog !== undefined)
|
|
37
|
+
return fromCatalog;
|
|
38
|
+
if (REASONING_HEURISTIC_EXACT.has(normalized))
|
|
39
|
+
return true;
|
|
40
|
+
return REASONING_HEURISTIC_PREFIXES.some((prefix) => normalized.startsWith(prefix));
|
|
41
|
+
}
|
|
42
|
+
function toModelDefinition(entry) {
|
|
43
|
+
return {
|
|
44
|
+
id: entry.id,
|
|
45
|
+
name: entry.name,
|
|
46
|
+
reasoning: entry.reasoning,
|
|
47
|
+
input: entry.vision ? ["text", "image"] : ["text"],
|
|
48
|
+
cost: ZERO_COST,
|
|
49
|
+
contextWindow: entry.contextWindow,
|
|
50
|
+
maxTokens: entry.maxTokens,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export function listAcedataChatModels() {
|
|
54
|
+
return GENERATED_CHAT_MODELS.map(toModelDefinition);
|
|
55
|
+
}
|
|
56
|
+
export function buildAcedataChatProvider() {
|
|
57
|
+
return {
|
|
58
|
+
baseUrl: ACEDATA_BASE_URL,
|
|
59
|
+
api: "openai-completions",
|
|
60
|
+
models: listAcedataChatModels(),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
|
|
2
|
+
export type AcedataSearchType = "search" | "images" | "news" | "videos" | "maps" | "places";
|
|
3
|
+
export type AcedataSearchOrganicResult = {
|
|
4
|
+
title?: string;
|
|
5
|
+
link?: string;
|
|
6
|
+
snippet?: string;
|
|
7
|
+
position?: number;
|
|
8
|
+
date?: string;
|
|
9
|
+
source?: string;
|
|
10
|
+
thumbnail?: string;
|
|
11
|
+
};
|
|
12
|
+
export type AcedataSearchResponse = {
|
|
13
|
+
type: AcedataSearchType;
|
|
14
|
+
query: string;
|
|
15
|
+
organic_results: AcedataSearchOrganicResult[];
|
|
16
|
+
knowledge_graph?: Record<string, unknown>;
|
|
17
|
+
answer_box?: Record<string, unknown>;
|
|
18
|
+
related_searches?: Array<{
|
|
19
|
+
query?: string;
|
|
20
|
+
}>;
|
|
21
|
+
total?: number;
|
|
22
|
+
raw?: unknown;
|
|
23
|
+
};
|
|
24
|
+
export type RunAcedataSearchArgs = {
|
|
25
|
+
cfg?: OpenClawConfig;
|
|
26
|
+
query: string;
|
|
27
|
+
type?: AcedataSearchType;
|
|
28
|
+
country?: string;
|
|
29
|
+
language?: string;
|
|
30
|
+
range?: string;
|
|
31
|
+
number?: number;
|
|
32
|
+
page?: number;
|
|
33
|
+
timeoutSeconds?: number;
|
|
34
|
+
};
|
|
35
|
+
export declare function runAcedataSearch(args: RunAcedataSearchArgs): Promise<AcedataSearchResponse>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { resolveAcedataSearchApiKey, resolveAcedataSearchBaseUrl, resolveAcedataSearchTimeoutSeconds, } from "./acedata-search-config.js";
|
|
2
|
+
const SEARCH_PATH = "/serp/google";
|
|
3
|
+
function buildSearchUrl(baseUrl) {
|
|
4
|
+
return `${baseUrl.replace(/\/$/, "")}${SEARCH_PATH}`;
|
|
5
|
+
}
|
|
6
|
+
function asString(value) {
|
|
7
|
+
return typeof value === "string" && value.trim() ? value : undefined;
|
|
8
|
+
}
|
|
9
|
+
function asNumber(value) {
|
|
10
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
11
|
+
}
|
|
12
|
+
function normalizeOrganicResults(value) {
|
|
13
|
+
if (!Array.isArray(value))
|
|
14
|
+
return [];
|
|
15
|
+
const out = [];
|
|
16
|
+
for (const item of value) {
|
|
17
|
+
if (!item || typeof item !== "object")
|
|
18
|
+
continue;
|
|
19
|
+
const row = item;
|
|
20
|
+
out.push({
|
|
21
|
+
title: asString(row.title),
|
|
22
|
+
link: asString(row.link) ?? asString(row.url),
|
|
23
|
+
snippet: asString(row.snippet) ?? asString(row.description),
|
|
24
|
+
position: asNumber(row.position),
|
|
25
|
+
date: asString(row.date),
|
|
26
|
+
source: asString(row.source),
|
|
27
|
+
thumbnail: asString(row.thumbnail),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
export async function runAcedataSearch(args) {
|
|
33
|
+
const { cfg, query, type = "search" } = args;
|
|
34
|
+
if (!query.trim()) {
|
|
35
|
+
throw new Error("Ace Data Cloud search query is required");
|
|
36
|
+
}
|
|
37
|
+
const apiKey = resolveAcedataSearchApiKey(cfg);
|
|
38
|
+
if (!apiKey) {
|
|
39
|
+
throw new Error("Ace Data Cloud API key not configured. Set ACEDATA_API_KEY env var or configure plugins.entries.acedatacloud.config.webSearch.apiKey.");
|
|
40
|
+
}
|
|
41
|
+
const baseUrl = resolveAcedataSearchBaseUrl(cfg);
|
|
42
|
+
const timeoutSeconds = resolveAcedataSearchTimeoutSeconds(args.timeoutSeconds);
|
|
43
|
+
const body = { query, type };
|
|
44
|
+
if (args.country)
|
|
45
|
+
body.country = args.country;
|
|
46
|
+
if (args.language)
|
|
47
|
+
body.language = args.language;
|
|
48
|
+
if (args.range)
|
|
49
|
+
body.range = args.range;
|
|
50
|
+
if (typeof args.number === "number" && args.number > 0)
|
|
51
|
+
body.number = args.number;
|
|
52
|
+
if (typeof args.page === "number" && args.page > 0)
|
|
53
|
+
body.page = args.page;
|
|
54
|
+
const controller = new AbortController();
|
|
55
|
+
const timer = setTimeout(() => controller.abort(), timeoutSeconds * 1000);
|
|
56
|
+
let response;
|
|
57
|
+
try {
|
|
58
|
+
response = await fetch(buildSearchUrl(baseUrl), {
|
|
59
|
+
method: "POST",
|
|
60
|
+
headers: {
|
|
61
|
+
Authorization: `Bearer ${apiKey}`,
|
|
62
|
+
"Content-Type": "application/json",
|
|
63
|
+
Accept: "application/json",
|
|
64
|
+
},
|
|
65
|
+
body: JSON.stringify(body),
|
|
66
|
+
signal: controller.signal,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
catch (cause) {
|
|
70
|
+
if (cause?.name === "AbortError") {
|
|
71
|
+
throw new Error(`Ace Data Cloud search timed out after ${timeoutSeconds}s`);
|
|
72
|
+
}
|
|
73
|
+
throw new Error(`Ace Data Cloud search request failed: ${cause.message}`, { cause });
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
clearTimeout(timer);
|
|
77
|
+
}
|
|
78
|
+
if (!response.ok) {
|
|
79
|
+
const text = await response.text().catch(() => "");
|
|
80
|
+
throw new Error(`Ace Data Cloud search API returned HTTP ${response.status}${text ? `: ${text.slice(0, 500)}` : ""}`);
|
|
81
|
+
}
|
|
82
|
+
let payload;
|
|
83
|
+
try {
|
|
84
|
+
payload = await response.json();
|
|
85
|
+
}
|
|
86
|
+
catch (cause) {
|
|
87
|
+
throw new Error("Ace Data Cloud search returned malformed JSON", { cause });
|
|
88
|
+
}
|
|
89
|
+
const root = (payload && typeof payload === "object" ? payload : {});
|
|
90
|
+
const data = (root.data && typeof root.data === "object" ? root.data : root) ?? {};
|
|
91
|
+
const organic = normalizeOrganicResults(data.organic_results ?? data.results ?? data.items);
|
|
92
|
+
const result = {
|
|
93
|
+
type,
|
|
94
|
+
query,
|
|
95
|
+
organic_results: organic,
|
|
96
|
+
};
|
|
97
|
+
if (data.knowledge_graph && typeof data.knowledge_graph === "object") {
|
|
98
|
+
result.knowledge_graph = data.knowledge_graph;
|
|
99
|
+
}
|
|
100
|
+
if (data.answer_box && typeof data.answer_box === "object") {
|
|
101
|
+
result.answer_box = data.answer_box;
|
|
102
|
+
}
|
|
103
|
+
if (Array.isArray(data.related_searches)) {
|
|
104
|
+
result.related_searches = data.related_searches
|
|
105
|
+
.map((item) => ({ query: asString(item?.query) }))
|
|
106
|
+
.filter((item) => Boolean(item.query));
|
|
107
|
+
}
|
|
108
|
+
if (typeof data.total === "number") {
|
|
109
|
+
result.total = data.total;
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
|
|
2
|
+
export declare const ACEDATA_SEARCH_DEFAULT_TIMEOUT_SECONDS = 30;
|
|
3
|
+
type AcedataSearchConfig = {
|
|
4
|
+
apiKey?: unknown;
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
} | undefined;
|
|
7
|
+
export declare function resolveAcedataSearchConfig(cfg?: OpenClawConfig): AcedataSearchConfig;
|
|
8
|
+
export declare function resolveAcedataSearchApiKey(cfg?: OpenClawConfig): string | undefined;
|
|
9
|
+
export declare function resolveAcedataSearchBaseUrl(cfg?: OpenClawConfig): string;
|
|
10
|
+
export declare function resolveAcedataSearchTimeoutSeconds(override?: number): number;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { resolvePositiveTimeoutSeconds } from "openclaw/plugin-sdk/provider-web-search";
|
|
2
|
+
import { normalizeResolvedSecretInputString, normalizeSecretInput, } from "openclaw/plugin-sdk/secret-input";
|
|
3
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
+
import { ACEDATA_BASE_URL } from "../constants.js";
|
|
5
|
+
export const ACEDATA_SEARCH_DEFAULT_TIMEOUT_SECONDS = 30;
|
|
6
|
+
export function resolveAcedataSearchConfig(cfg) {
|
|
7
|
+
const pluginConfig = cfg?.plugins?.entries?.acedatacloud?.config;
|
|
8
|
+
const ws = pluginConfig?.webSearch;
|
|
9
|
+
if (ws && typeof ws === "object" && !Array.isArray(ws)) {
|
|
10
|
+
return ws;
|
|
11
|
+
}
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
function normalizeConfiguredSecret(value, path) {
|
|
15
|
+
return normalizeSecretInput(normalizeResolvedSecretInputString({
|
|
16
|
+
value,
|
|
17
|
+
path,
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
export function resolveAcedataSearchApiKey(cfg) {
|
|
21
|
+
const search = resolveAcedataSearchConfig(cfg);
|
|
22
|
+
const fromSearch = normalizeConfiguredSecret(search?.apiKey, "plugins.entries.acedatacloud.config.webSearch.apiKey");
|
|
23
|
+
if (fromSearch)
|
|
24
|
+
return fromSearch;
|
|
25
|
+
const fromChat = normalizeConfiguredSecret(cfg?.plugins?.entries?.acedatacloud?.config
|
|
26
|
+
?.providerCredentials?.acedatacloud?.apiKey, "plugins.entries.acedatacloud.config.providerCredentials.acedatacloud.apiKey");
|
|
27
|
+
if (fromChat)
|
|
28
|
+
return fromChat;
|
|
29
|
+
return (normalizeSecretInput(process.env.ACEDATA_API_KEY) ||
|
|
30
|
+
normalizeSecretInput(process.env.ACEDATACLOUD_API_KEY) ||
|
|
31
|
+
undefined);
|
|
32
|
+
}
|
|
33
|
+
export function resolveAcedataSearchBaseUrl(cfg) {
|
|
34
|
+
const search = resolveAcedataSearchConfig(cfg);
|
|
35
|
+
const configured = (normalizeOptionalString(search?.baseUrl) ?? "") ||
|
|
36
|
+
normalizeSecretInput(process.env.ACEDATA_BASE_URL) ||
|
|
37
|
+
"";
|
|
38
|
+
if (!configured) {
|
|
39
|
+
return ACEDATA_BASE_URL.replace(/\/v1\/?$/, "");
|
|
40
|
+
}
|
|
41
|
+
return configured.replace(/\/$/, "");
|
|
42
|
+
}
|
|
43
|
+
export function resolveAcedataSearchTimeoutSeconds(override) {
|
|
44
|
+
return resolvePositiveTimeoutSeconds(override, ACEDATA_SEARCH_DEFAULT_TIMEOUT_SECONDS);
|
|
45
|
+
}
|