@teith/openclaw-runware-provider 0.2.3 → 0.2.5

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,43 @@
1
+ interface DiscoveryEnv {
2
+ env?: Record<string, string | undefined>;
3
+ }
4
+ declare function buildProvider(ctx: DiscoveryEnv): Promise<{
5
+ provider: {
6
+ baseUrl: string;
7
+ apiKey: string;
8
+ api: "openai-completions";
9
+ timeoutSeconds: number;
10
+ models: {
11
+ id: string;
12
+ name: string;
13
+ reasoning: boolean;
14
+ input: readonly ["text"];
15
+ contextWindow: number;
16
+ maxTokens: number;
17
+ cost: {
18
+ input: number;
19
+ output: number;
20
+ cacheRead: number;
21
+ cacheWrite: number;
22
+ };
23
+ params: {
24
+ readonly extra_body: {
25
+ readonly reasoning_effort: "high";
26
+ };
27
+ };
28
+ }[];
29
+ };
30
+ }>;
31
+ declare const runwareProviderDiscovery: {
32
+ id: string;
33
+ label: string;
34
+ docsPath: string;
35
+ envVars: string[];
36
+ auth: never[];
37
+ catalog: {
38
+ order: "late";
39
+ run: typeof buildProvider;
40
+ };
41
+ };
42
+ export default runwareProviderDiscovery;
43
+ //# 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,UAAU,YAAY;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C;AAuBD,iBAAe,aAAa,CAAC,GAAG,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;GAuC7C;AAED,QAAA,MAAM,wBAAwB;;;;;;;;;;CAU7B,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
@@ -0,0 +1,82 @@
1
+ import { fetchModelIds } from "./catalog.js";
2
+ const PROVIDER_ID = "runware";
3
+ const PROVIDER_LABEL = "Runware";
4
+ const DEFAULT_BASE_URL = "https://api.runware.ai/v1";
5
+ const API_KEY_ENV_VAR = "RUNWARE_API_KEY";
6
+ const BASE_URL_ENV_VAR = "RUNWARE_BASE_URL";
7
+ const REQUEST_TIMEOUT_SECONDS = 600;
8
+ const MODEL_CONTEXT_WINDOW = 200_000;
9
+ const MODEL_MAX_TOKENS = 32_768;
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 raw = env?.[BASE_URL_ENV_VAR] ?? process.env[BASE_URL_ENV_VAR];
14
+ const override = typeof raw === "string" ? raw.trim() : "";
15
+ return override.length > 0 ? override : DEFAULT_BASE_URL;
16
+ }
17
+ function getApiKey(env) {
18
+ const raw = env?.[API_KEY_ENV_VAR] ?? process.env[API_KEY_ENV_VAR];
19
+ return typeof raw === "string" && raw.length > 0 ? raw : undefined;
20
+ }
21
+ function humanizeModelId(id) {
22
+ return id
23
+ .replace(/[-_:@]/g, " ")
24
+ .replace(/\bfp8\b/gi, "FP8")
25
+ .trim()
26
+ .split(/\s+/)
27
+ .map((w) => (w.length > 0 ? w[0].toUpperCase() + w.slice(1) : w))
28
+ .join(" ");
29
+ }
30
+ async function buildProvider(ctx) {
31
+ // eslint-disable-next-line no-console
32
+ console.error("[runware-plugin] staticCatalog.run called, ctx keys:", Object.keys(ctx ?? {}));
33
+ const apiKey = getApiKey(ctx.env);
34
+ // eslint-disable-next-line no-console
35
+ console.error("[runware-plugin] staticCatalog apiKey:", apiKey ? "yes" : "no");
36
+ if (!apiKey) {
37
+ return {
38
+ provider: {
39
+ baseUrl: DEFAULT_BASE_URL,
40
+ apiKey: "",
41
+ api: "openai-completions",
42
+ timeoutSeconds: REQUEST_TIMEOUT_SECONDS,
43
+ models: [],
44
+ },
45
+ };
46
+ }
47
+ const baseUrl = getBaseUrl(ctx.env);
48
+ const ids = await fetchModelIds(baseUrl, apiKey);
49
+ // eslint-disable-next-line no-console
50
+ console.error("[runware-plugin] staticCatalog fetched", ids.length, "models");
51
+ return {
52
+ provider: {
53
+ baseUrl,
54
+ apiKey,
55
+ api: "openai-completions",
56
+ timeoutSeconds: REQUEST_TIMEOUT_SECONDS,
57
+ models: ids.map((id) => ({
58
+ id,
59
+ name: humanizeModelId(id),
60
+ reasoning: true,
61
+ input: ["text"],
62
+ contextWindow: MODEL_CONTEXT_WINDOW,
63
+ maxTokens: MODEL_MAX_TOKENS,
64
+ cost: ZERO_COST,
65
+ params: MODEL_PARAMS,
66
+ })),
67
+ },
68
+ };
69
+ }
70
+ const runwareProviderDiscovery = {
71
+ id: PROVIDER_ID,
72
+ label: PROVIDER_LABEL,
73
+ docsPath: "https://docs.runware.ai",
74
+ envVars: [API_KEY_ENV_VAR, BASE_URL_ENV_VAR],
75
+ auth: [],
76
+ catalog: {
77
+ order: "late",
78
+ run: buildProvider,
79
+ },
80
+ };
81
+ export default runwareProviderDiscovery;
82
+ //# 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;AAE7C,MAAM,WAAW,GAAG,SAAS,CAAC;AAC9B,MAAM,cAAc,GAAG,SAAS,CAAC;AACjC,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,YAAY,GAAG,EAAE,UAAU,EAAE,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAW,CAAC;AAC3E,MAAM,SAAS,GAAG,EAAE,KAAK,EAAE,CAAC,E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wB,GAAG;IAC/B,EAAE,EAAE,WAAW;IACf,KAAK,EAAE,cAAc;IACrB,QAAQ,EAAE,yBAAyB;IACnC,OAAO,EAAE,CAAC,eAAe,EAAE,gBAAgB,CAAC;IAC5C,IAAI,EAAE,EAAE;IACR,OAAO,EAAE;QACP,KAAK,EAAE,MAAe;QACtB,GAAG,EAAE,aAAa;KACnB;CACF,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
@@ -12,6 +12,7 @@
12
12
  "activation": { "onStartup": true },
13
13
  "enabledByDefault": true,
14
14
  "providers": ["runware"],
15
+ "providerCatalogEntry": "./dist/provider-discovery.js",
15
16
  "providerAuthEnvVars": {
16
17
  "runware": ["RUNWARE_API_KEY"]
17
18
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teith/openclaw-runware-provider",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
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",