@teith/openclaw-runware-provider 0.1.2 → 0.1.4

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.
@@ -0,0 +1,15 @@
1
+ import type { CatalogContext, CatalogOrder, ProviderShape } from "./openclaw-api.js";
2
+ declare const runwareProviderDiscovery: {
3
+ id: string;
4
+ label: string;
5
+ docsPath: string;
6
+ auth: never[];
7
+ staticCatalog: {
8
+ order: CatalogOrder;
9
+ run: (ctx: CatalogContext) => Promise<{
10
+ provider: ProviderShape;
11
+ }>;
12
+ };
13
+ };
14
+ export default runwareProviderDiscovery;
15
+ //# sourceMappingURL=provider-discovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-discovery.d.ts","sourceRoot":"","sources":["../src/provider-discovery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EAEZ,aAAa,EACd,MAAM,mBAAmB,CAAC;AAqE3B,QAAA,MAAM,wBAAwB;;;;;;eAMP,YAAY;mBACd,cAAc;;;;CAWlC,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
@@ -0,0 +1,84 @@
1
+ import { fetchModelIds } from "./catalog.js";
2
+ const PROVIDER_ID = "runware";
3
+ const DEFAULT_BASE_URL = "https://api.runware.ai/v1";
4
+ const API_KEY_ENV_VAR = "RUNWARE_API_KEY";
5
+ const BASE_URL_ENV_VAR = "RUNWARE_BASE_URL";
6
+ const REQUEST_TIMEOUT_SECONDS = 600;
7
+ const MODEL_CONTEXT_WINDOW = 200_000;
8
+ const MODEL_MAX_TOKENS = 32_768;
9
+ const MODEL_INPUT_MODALITIES = ["text"];
10
+ const MODEL_PARAMS = { extra_body: { reasoning_effort: "high" } };
11
+ const ZERO_COST = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
12
+ function getBaseUrl(env) {
13
+ const override = (env?.[BASE_URL_ENV_VAR] ?? process.env[BASE_URL_ENV_VAR])?.trim();
14
+ return override && override.length > 0 ? override : DEFAULT_BASE_URL;
15
+ }
16
+ function resolveApiKey(ctx) {
17
+ const fromAuth = ctx.resolveProviderApiKey?.(PROVIDER_ID).apiKey;
18
+ if (fromAuth && fromAuth.length > 0)
19
+ return fromAuth;
20
+ return ctx.env?.[API_KEY_ENV_VAR] ?? process.env[API_KEY_ENV_VAR];
21
+ }
22
+ function humanizeModelId(id) {
23
+ return id
24
+ .replace(/[-_:@]/g, " ")
25
+ .replace(/\bfp8\b/gi, "FP8")
26
+ .trim()
27
+ .split(/\s+/)
28
+ .map((w) => (w.length > 0 ? w[0].toUpperCase() + w.slice(1) : w))
29
+ .join(" ");
30
+ }
31
+ function buildModelEntry(id) {
32
+ return {
33
+ id,
34
+ name: humanizeModelId(id),
35
+ reasoning: true,
36
+ input: MODEL_INPUT_MODALITIES,
37
+ contextWindow: MODEL_CONTEXT_WINDOW,
38
+ maxTokens: MODEL_MAX_TOKENS,
39
+ cost: ZERO_COST,
40
+ params: MODEL_PARAMS,
41
+ };
42
+ }
43
+ async function buildProvider(apiKey, baseUrl) {
44
+ const ids = await fetchModelIds(baseUrl, apiKey);
45
+ return {
46
+ baseUrl,
47
+ apiKey,
48
+ api: "openai-completions",
49
+ timeoutSeconds: REQUEST_TIMEOUT_SECONDS,
50
+ models: ids.map(buildModelEntry),
51
+ };
52
+ }
53
+ function buildStaticProvider(baseUrl) {
54
+ return {
55
+ baseUrl,
56
+ apiKey: "",
57
+ api: "openai-completions",
58
+ timeoutSeconds: REQUEST_TIMEOUT_SECONDS,
59
+ models: [],
60
+ };
61
+ }
62
+ const runwareProviderDiscovery = {
63
+ id: PROVIDER_ID,
64
+ label: "Runware",
65
+ docsPath: "https://docs.runware.ai",
66
+ auth: [],
67
+ staticCatalog: {
68
+ order: "simple",
69
+ run: async (ctx) => {
70
+ const apiKey = resolveApiKey(ctx);
71
+ const baseUrl = getBaseUrl(ctx.env);
72
+ if (!apiKey)
73
+ return { provider: buildStaticProvider(baseUrl) };
74
+ try {
75
+ return { provider: await buildProvider(apiKey, baseUrl) };
76
+ }
77
+ catch {
78
+ return { provider: buildStaticProvider(baseUrl) };
79
+ }
80
+ },
81
+ },
82
+ };
83
+ export default runwareProviderDiscovery;
84
+ //# sourceMappingURL=provider-discovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-discovery.js","sourceRoot":"","sources":["../src/provider-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAQ7C,MAAM,WAAW,GAAG,SAAS,CAAC;AAC9B,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AACrD,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAC1C,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAC5C,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAEpC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AACrC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,MAAM,sBAAsB,GAAG,CAAC,MAAM,CAAC,CAAC;AACxC,MAAM,YAAY,GAAG,EAAE,UAAU,EAAE,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAW,CAAC;AAC3E,MAAM,SAAS,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;AAEvE,SAAS,UAAU,CAAC,GAAwC;IAC1D,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;IACpF,OAAO,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC;AACvE,CAAC;AAED,SAAS,aAAa,CAAC,GAAmB;IACxC,MAAM,QAAQ,GAAG,GAAG,CAAC,qBAAqB,EAAE,CAA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,SAAS,mBAAmB,CAAC,OAAe;IAC1C,OAAO;QACL,OAAO;QACP,MAAM,EAAE,EAAE;QACV,GAAG,EAAE,oBAAoB;QACzB,cAAc,EAAE,uBAAuB;QACvC,MAAM,EAAE,EAAE;KACX,CAAC;AACJ,CAAC;AAED,MAAM,wBAAwB,GAAG;IAC/B,EAAE,EAAE,WAAW;IACf,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,yBAAyB;IACnC,IAAI,EAAE,EAAE;IACR,aAAa,EAAE;QACb,KAAK,EAAE,QAAwB;QAC/B,GAAG,EAAE,KAAK,EAAE,GAAmB,EAAE,EAAE;YACjC,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;YAClC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACpC,IAAI,CAAC,MAAM;gBAAE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/D,IAAI,CAAC;gBACH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;YAC5D,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,EAAE,QAAQ,EAAE,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;YACpD,CAAC;QACH,CAAC;KACF;CACF,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
@@ -10,6 +10,7 @@
10
10
  "properties": {}
11
11
  },
12
12
  "activation": { "onStartup": true },
13
+ "providerCatalogEntry": "./dist/provider-discovery.js",
13
14
  "providers": ["runware"],
14
15
  "providerRequest": {
15
16
  "providers": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teith/openclaw-runware-provider",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "OpenClaw provider plugin for Runware — unified OpenAI-compatible access to Claude, GPT, Gemini, Qwen, GLM, MiniMax, Kimi, and Gemma.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,7 +14,12 @@
14
14
  },
15
15
  "./openclaw.plugin.json": "./openclaw.plugin.json"
16
16
  },
17
- "files": ["dist", "openclaw.plugin.json", "README.md", "LICENSE"],
17
+ "files": [
18
+ "dist",
19
+ "openclaw.plugin.json",
20
+ "README.md",
21
+ "LICENSE"
22
+ ],
18
23
  "scripts": {
19
24
  "build": "tsc -p tsconfig.build.json",
20
25
  "dev": "tsc -p tsconfig.build.json --watch",
@@ -26,15 +31,28 @@
26
31
  },
27
32
  "openclaw": {
28
33
  "id": "runware-openclaw-provider",
29
- "extensions": ["./dist/index.js"],
30
- "providers": ["runware"]
34
+ "extensions": [
35
+ "./dist/index.js",
36
+ "./dist/provider-discovery.js"
37
+ ],
38
+ "providers": [
39
+ "runware"
40
+ ]
31
41
  },
32
42
  "repository": {
33
43
  "type": "git",
34
44
  "url": "https://github.com/runware/openclaw-provider.git"
35
45
  },
36
- "keywords": ["openclaw", "openclaw-plugin", "runware", "llm", "ai-provider"],
37
- "engines": { "node": ">=20" },
46
+ "keywords": [
47
+ "openclaw",
48
+ "openclaw-plugin",
49
+ "runware",
50
+ "llm",
51
+ "ai-provider"
52
+ ],
53
+ "engines": {
54
+ "node": ">=20"
55
+ },
38
56
  "devDependencies": {
39
57
  "@types/node": "^22.0.0",
40
58
  "typescript": "^5.6.0",