@openclaw/cohere-provider 0.0.0

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/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # OpenClaw Cohere Provider
2
+
3
+ Official OpenClaw provider plugin for Cohere's OpenAI-compatible Compatibility
4
+ API.
5
+
6
+ Install from OpenClaw:
7
+
8
+ ```bash
9
+ openclaw plugins install @openclaw/cohere-provider
10
+ openclaw gateway restart
11
+ ```
12
+
13
+ Configure a Cohere API key, then select `cohere/command-a-03-2025`.
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ import { COHERE_DEFAULT_MODEL_REF, applyCohereConfig } from "./onboard.js";
2
+ import { buildCohereProvider } from "./provider-catalog.js";
3
+ import { createCohereCompletionsWrapper } from "./stream.js";
4
+ import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
5
+ //#region extensions/cohere/index.ts
6
+ var cohere_default = defineSingleProviderPluginEntry({
7
+ id: "cohere",
8
+ name: "Cohere Provider",
9
+ description: "Cohere provider plugin",
10
+ provider: {
11
+ label: "Cohere",
12
+ docsPath: "/providers/cohere",
13
+ auth: [{
14
+ methodId: "api-key",
15
+ label: "Cohere API key",
16
+ hint: "OpenAI-compatible inference",
17
+ optionKey: "cohereApiKey",
18
+ flagName: "--cohere-api-key",
19
+ envVar: "COHERE_API_KEY",
20
+ promptMessage: "Enter Cohere API key",
21
+ defaultModel: COHERE_DEFAULT_MODEL_REF,
22
+ applyConfig: (cfg) => applyCohereConfig(cfg),
23
+ wizard: {
24
+ groupLabel: "Cohere",
25
+ groupHint: "OpenAI-compatible inference"
26
+ }
27
+ }],
28
+ catalog: {
29
+ buildProvider: buildCohereProvider,
30
+ buildStaticProvider: buildCohereProvider
31
+ },
32
+ wrapStreamFn: (ctx) => createCohereCompletionsWrapper(ctx.streamFn),
33
+ wrapSimpleCompletionStreamFn: (ctx) => createCohereCompletionsWrapper(ctx.streamFn)
34
+ }
35
+ });
36
+ //#endregion
37
+ export { cohere_default as default };
@@ -0,0 +1,50 @@
1
+ import { buildManifestModelProviderConfig } from "openclaw/plugin-sdk/provider-catalog-shared";
2
+ //#endregion
3
+ //#region extensions/cohere/models.ts
4
+ /**
5
+ * Cohere model catalog helpers derived from the plugin manifest.
6
+ */
7
+ const COHERE_MANIFEST_CATALOG = {
8
+ "providers": { "cohere": {
9
+ "baseUrl": "https://api.cohere.ai/compatibility/v1",
10
+ "api": "openai-completions",
11
+ "models": [{
12
+ "id": "command-a-03-2025",
13
+ "name": "Command A",
14
+ "input": ["text"],
15
+ "contextWindow": 256e3,
16
+ "maxTokens": 8e3,
17
+ "cost": {
18
+ "input": 2.5,
19
+ "output": 10,
20
+ "cacheRead": 0,
21
+ "cacheWrite": 0
22
+ },
23
+ "compat": {
24
+ "supportsStore": false,
25
+ "supportsUsageInStreaming": false,
26
+ "maxTokensField": "max_tokens"
27
+ }
28
+ }]
29
+ } },
30
+ "discovery": { "cohere": "static" }
31
+ }.providers.cohere;
32
+ const COHERE_BASE_URL = COHERE_MANIFEST_CATALOG.baseUrl;
33
+ const COHERE_MODEL_CATALOG = COHERE_MANIFEST_CATALOG.models;
34
+ function buildCohereCatalogModels() {
35
+ return buildManifestModelProviderConfig({
36
+ providerId: "cohere",
37
+ catalog: COHERE_MANIFEST_CATALOG
38
+ }).models;
39
+ }
40
+ function buildCohereModelDefinition(model) {
41
+ return buildManifestModelProviderConfig({
42
+ providerId: "cohere",
43
+ catalog: {
44
+ ...COHERE_MANIFEST_CATALOG,
45
+ models: [model]
46
+ }
47
+ }).models[0];
48
+ }
49
+ //#endregion
50
+ export { buildCohereModelDefinition as i, COHERE_MODEL_CATALOG as n, buildCohereCatalogModels as r, COHERE_BASE_URL as t };
package/dist/models.js ADDED
@@ -0,0 +1,2 @@
1
+ import { i as buildCohereModelDefinition, n as COHERE_MODEL_CATALOG, r as buildCohereCatalogModels, t as COHERE_BASE_URL } from "./models-CEKJlK4t.js";
2
+ export { COHERE_BASE_URL, COHERE_MODEL_CATALOG, buildCohereCatalogModels, buildCohereModelDefinition };
@@ -0,0 +1,26 @@
1
+ import { i as buildCohereModelDefinition, n as COHERE_MODEL_CATALOG, t as COHERE_BASE_URL } from "./models-CEKJlK4t.js";
2
+ import { createModelCatalogPresetAppliers } from "openclaw/plugin-sdk/provider-onboard";
3
+ //#region extensions/cohere/onboard.ts
4
+ const COHERE_DEFAULT_MODEL_ID = "command-a-03-2025";
5
+ const COHERE_DEFAULT_MODEL_REF = `cohere/${COHERE_DEFAULT_MODEL_ID}`;
6
+ const coherePresetAppliers = createModelCatalogPresetAppliers({
7
+ primaryModelRef: COHERE_DEFAULT_MODEL_REF,
8
+ resolveParams: (_cfg) => ({
9
+ providerId: "cohere",
10
+ api: "openai-completions",
11
+ baseUrl: COHERE_BASE_URL,
12
+ catalogModels: COHERE_MODEL_CATALOG.map(buildCohereModelDefinition),
13
+ aliases: [{
14
+ modelRef: COHERE_DEFAULT_MODEL_REF,
15
+ alias: "Cohere Command A"
16
+ }]
17
+ })
18
+ });
19
+ function applyCohereProviderConfig(cfg) {
20
+ return coherePresetAppliers.applyProviderConfig(cfg);
21
+ }
22
+ function applyCohereConfig(cfg) {
23
+ return coherePresetAppliers.applyConfig(cfg);
24
+ }
25
+ //#endregion
26
+ export { COHERE_DEFAULT_MODEL_ID, COHERE_DEFAULT_MODEL_REF, applyCohereConfig, applyCohereProviderConfig };
@@ -0,0 +1,11 @@
1
+ import { r as buildCohereCatalogModels, t as COHERE_BASE_URL } from "./models-CEKJlK4t.js";
2
+ //#region extensions/cohere/provider-catalog.ts
3
+ function buildCohereProvider() {
4
+ return {
5
+ baseUrl: COHERE_BASE_URL,
6
+ api: "openai-completions",
7
+ models: buildCohereCatalogModels()
8
+ };
9
+ }
10
+ //#endregion
11
+ export { buildCohereProvider };
package/dist/stream.js ADDED
@@ -0,0 +1,14 @@
1
+ import { createPayloadPatchStreamWrapper } from "openclaw/plugin-sdk/provider-stream-shared";
2
+ //#region extensions/cohere/stream.ts
3
+ function patchCoherePayload(payload) {
4
+ if (Array.isArray(payload.messages)) payload.messages = payload.messages.map((message) => message && typeof message === "object" && message.role === "system" ? {
5
+ ...message,
6
+ role: "developer"
7
+ } : message);
8
+ delete payload.tool_choice;
9
+ }
10
+ function createCohereCompletionsWrapper(baseStreamFn) {
11
+ return createPayloadPatchStreamWrapper(baseStreamFn, ({ payload }) => patchCoherePayload(payload));
12
+ }
13
+ //#endregion
14
+ export { createCohereCompletionsWrapper };
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@openclaw/cohere-provider",
3
+ "version": "0.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "@openclaw/cohere-provider",
9
+ "version": "0.0.0"
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "id": "cohere",
3
+ "name": "Cohere",
4
+ "description": "OpenClaw Cohere provider plugin.",
5
+ "activation": {
6
+ "onStartup": false
7
+ },
8
+ "enabledByDefault": true,
9
+ "providers": ["cohere"],
10
+ "modelCatalog": {
11
+ "providers": {
12
+ "cohere": {
13
+ "baseUrl": "https://api.cohere.ai/compatibility/v1",
14
+ "api": "openai-completions",
15
+ "models": [
16
+ {
17
+ "id": "command-a-03-2025",
18
+ "name": "Command A",
19
+ "input": ["text"],
20
+ "contextWindow": 256000,
21
+ "maxTokens": 8000,
22
+ "cost": {
23
+ "input": 2.5,
24
+ "output": 10,
25
+ "cacheRead": 0,
26
+ "cacheWrite": 0
27
+ },
28
+ "compat": {
29
+ "supportsStore": false,
30
+ "supportsUsageInStreaming": false,
31
+ "maxTokensField": "max_tokens"
32
+ }
33
+ }
34
+ ]
35
+ }
36
+ },
37
+ "discovery": {
38
+ "cohere": "static"
39
+ }
40
+ },
41
+ "setup": {
42
+ "providers": [
43
+ {
44
+ "id": "cohere",
45
+ "envVars": ["COHERE_API_KEY"]
46
+ }
47
+ ]
48
+ },
49
+ "providerAuthChoices": [
50
+ {
51
+ "provider": "cohere",
52
+ "method": "api-key",
53
+ "choiceId": "cohere-api-key",
54
+ "choiceLabel": "Cohere API key",
55
+ "groupId": "cohere",
56
+ "groupLabel": "Cohere",
57
+ "groupHint": "OpenAI-compatible inference",
58
+ "optionKey": "cohereApiKey",
59
+ "cliFlag": "--cohere-api-key",
60
+ "cliOption": "--cohere-api-key <key>",
61
+ "cliDescription": "Cohere API key"
62
+ }
63
+ ],
64
+ "configSchema": {
65
+ "type": "object",
66
+ "additionalProperties": false,
67
+ "properties": {}
68
+ }
69
+ }
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@openclaw/cohere-provider",
3
+ "version": "0.0.0",
4
+ "description": "OpenClaw Cohere provider plugin.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/openclaw/openclaw"
8
+ },
9
+ "type": "module",
10
+ "devDependencies": {
11
+ "@openclaw/plugin-sdk": "workspace:*"
12
+ },
13
+ "openclaw": {
14
+ "extensions": [
15
+ "./index.ts"
16
+ ],
17
+ "install": {
18
+ "clawhubSpec": "clawhub:@openclaw/cohere-provider",
19
+ "npmSpec": "@openclaw/cohere-provider",
20
+ "defaultChoice": "npm",
21
+ "minHostVersion": ">=2026.6.8"
22
+ },
23
+ "compat": {
24
+ "pluginApi": ">=2026.6.8"
25
+ },
26
+ "build": {
27
+ "openclawVersion": "2026.6.8",
28
+ "bundledDist": true
29
+ },
30
+ "release": {
31
+ "publishToClawHub": true,
32
+ "publishToNpm": true
33
+ },
34
+ "runtimeExtensions": [
35
+ "./dist/index.js"
36
+ ]
37
+ },
38
+ "files": [
39
+ "dist/**",
40
+ "openclaw.plugin.json",
41
+ "npm-shrinkwrap.json",
42
+ "README.md"
43
+ ],
44
+ "peerDependencies": {
45
+ "openclaw": ">=2026.6.8"
46
+ },
47
+ "peerDependenciesMeta": {
48
+ "openclaw": {
49
+ "optional": true
50
+ }
51
+ }
52
+ }