@ckcloudai.com/clawrouter 0.0.1

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ckcloudai
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,16 @@
1
+ # Clawrouter
2
+
3
+ ## Overview
4
+
5
+ Clawrouter is an access hub for LLM and OpenClaw services built around the X402 payment network. It unifies billing, invocation, and authorization so usage shifts from traditional top-up workflows to real-time settlement via X402.
6
+
7
+ ## Key Features
8
+
9
+ - **X402 payment gateway**: Handle usage fees directly through X402 channels, no manual balance management required.
10
+ - **Unified LLM invocations**: Provide a consolidated interface for mainstream models while hiding low-level billing and permission differences.
11
+ - **OpenClaw bridging**: Expose OpenClaw capabilities through the same surface, giving upper-layer services a consistent API experience.
12
+ - **Agent-friendly automation**: Designed for multi-agent scenarios with streamlined automated calls, renewals, and task scheduling.
13
+
14
+ ## Use Cases
15
+
16
+ Ideal for agent-style applications that need to trigger LLM/OpenClaw services in batch or autonomously (multi-agent coordination, task bots, etc.). Especially useful when settlements must occur through the X402 ledger, significantly reducing integration and operations overhead.
@@ -0,0 +1,126 @@
1
+ type ModelApi = "openai-completions" | "openai-responses" | "anthropic-messages" | "google-generative-ai" | "github-copilot" | "bedrock-converse-stream";
2
+ type ModelDefinitionConfig = {
3
+ id: string;
4
+ name: string;
5
+ api?: ModelApi;
6
+ reasoning: boolean;
7
+ input: Array<"text" | "image">;
8
+ cost: {
9
+ input: number;
10
+ output: number;
11
+ cacheRead: number;
12
+ cacheWrite: number;
13
+ };
14
+ contextWindow: number;
15
+ maxTokens: number;
16
+ headers?: Record<string, string>;
17
+ };
18
+ type ModelProviderConfig = {
19
+ baseUrl: string;
20
+ apiKey?: string;
21
+ api?: ModelApi;
22
+ headers?: Record<string, string>;
23
+ authHeader?: boolean;
24
+ models: ModelDefinitionConfig[];
25
+ };
26
+ type WizardPrompter = {
27
+ text: (opts: {
28
+ message: string;
29
+ validate?: (value: string) => string | undefined;
30
+ }) => Promise<string | symbol>;
31
+ note: (message: string) => void;
32
+ progress: (message: string) => {
33
+ stop: (message?: string) => void;
34
+ };
35
+ };
36
+ type ProviderAuthContext = {
37
+ config: Record<string, unknown>;
38
+ agentDir?: string;
39
+ workspaceDir?: string;
40
+ prompter: WizardPrompter;
41
+ runtime: {
42
+ log: (message: string) => void;
43
+ };
44
+ isRemote: boolean;
45
+ openUrl: (url: string) => Promise<void>;
46
+ };
47
+ type AuthProfileCredential = {
48
+ apiKey?: string;
49
+ type?: string;
50
+ [key: string]: unknown;
51
+ };
52
+ type ProviderAuthResult = {
53
+ profiles: Array<{
54
+ profileId: string;
55
+ credential: AuthProfileCredential;
56
+ }>;
57
+ configPatch?: Record<string, unknown>;
58
+ defaultModel?: string;
59
+ notes?: string[];
60
+ };
61
+ type ProviderAuthMethod = {
62
+ id: string;
63
+ label: string;
64
+ hint?: string;
65
+ kind: "oauth" | "api_key" | "token" | "device_code" | "custom";
66
+ run: (ctx: ProviderAuthContext) => Promise<ProviderAuthResult>;
67
+ };
68
+ type ProviderPlugin = {
69
+ id: string;
70
+ label: string;
71
+ docsPath?: string;
72
+ aliases?: string[];
73
+ envVars?: string[];
74
+ models?: ModelProviderConfig;
75
+ auth: ProviderAuthMethod[];
76
+ formatApiKey?: (cred: AuthProfileCredential) => string;
77
+ };
78
+ type PluginLogger = {
79
+ debug?: (message: string) => void;
80
+ info: (message: string) => void;
81
+ warn: (message: string) => void;
82
+ error: (message: string) => void;
83
+ };
84
+ type OpenClawPluginService = {
85
+ id: string;
86
+ start: () => void | Promise<void>;
87
+ stop?: () => void | Promise<void>;
88
+ };
89
+ type OpenClawPluginApi = {
90
+ id: string;
91
+ name: string;
92
+ version?: string;
93
+ description?: string;
94
+ source: string;
95
+ config: Record<string, unknown> & {
96
+ models?: {
97
+ providers?: Record<string, ModelProviderConfig>;
98
+ };
99
+ agents?: Record<string, unknown>;
100
+ };
101
+ pluginConfig?: Record<string, unknown>;
102
+ logger: PluginLogger;
103
+ registerProvider: (provider: ProviderPlugin) => void;
104
+ registerTool: (tool: unknown, opts?: unknown) => void;
105
+ registerHook: (events: string | string[], handler: unknown, opts?: unknown) => void;
106
+ registerHttpRoute: (params: {
107
+ path: string;
108
+ handler: unknown;
109
+ }) => void;
110
+ registerService: (service: OpenClawPluginService) => void;
111
+ registerCommand: (command: unknown) => void;
112
+ resolvePath: (input: string) => string;
113
+ on: (hookName: string, handler: unknown, opts?: unknown) => void;
114
+ };
115
+ type OpenClawPluginDefinition = {
116
+ id?: string;
117
+ name?: string;
118
+ description?: string;
119
+ version?: string;
120
+ register?: (api: OpenClawPluginApi) => void | Promise<void>;
121
+ activate?: (api: OpenClawPluginApi) => void | Promise<void>;
122
+ };
123
+
124
+ declare const plugin: OpenClawPluginDefinition;
125
+
126
+ export { plugin as default };