@aiagenta2z/onekey-gateway 0.1.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 +245 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +202 -0
- package/dist/client.d.ts +42 -0
- package/dist/client.js +59 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# OneKey Gateway
|
|
2
|
+
AI Agent Gateway to Commercial APIs, Skills, MCPs and more using just one access key for most benefits.
|
|
3
|
+
|
|
4
|
+
[GitHub](https://github.com/aiagenta2z/onekey-gateway)|[Document](http://www.deepnlp.org/doc/onekey_gateway)|[AI Agent Marketplace](http://www.deepnlp.org/store/ai-agent)|[AI Agent Search](http://www.deepnlp.org/search/agent) | [AI Agent A2Z Deployment](https://deepnlp.org/doc/agent_mcp_deployment) | [Agent A2Z Payment](https://www.deepnlp.org/doc/agent_a2z_payment)
|
|
5
|
+
|
|
6
|
+
**Onekey Gateway** focuses on commercial agent APIs/MCPs/Skills, which typically require multiple subscriptions or access keys for web search,image generation, financial data, 3D rendering.
|
|
7
|
+
Our mission is to help users authenticate once and enjoy the most benefits, discounted, pay-as-you-go usage. Accessing Agent APIs, MCPs, and LLMs across 30+ categories and 100+ tools via our credit system,
|
|
8
|
+
you can eliminate multiple expensive subscriptions and maximize your benefits. More SOTA agent/models are available in the [DeepNLP AI Agent Mareketplace](https://deepnlp.org/store/ai-agent).
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
[OneKey Gateway Document](https://www.deepnlp.org/doc/onekey_gateway)
|
|
12
|
+
|
|
13
|
+
OneKey Gateway provides CLI tool, Restful API, MCP, Skills and Python/Typescript methods for Agent and human to use commercial Agent APIs.
|
|
14
|
+
|
|
15
|
+
| Gateway Type | Description | BASE URL | CLI |
|
|
16
|
+
|-------------|---------------------------------------------------------------------------------------------------------------|----------------------------------------|----------------|
|
|
17
|
+
| Agent APIs | Allow your AI Agent to Access APIs [OneKey Agent Router Doc](https://www.deepnlp.org/doc/onekey_agent_router) | https://agent.deepnlp.org/agent_router | `onekey agent` |
|
|
18
|
+
| MCP | Allow your AI clients to connect to commercial Http MCP [OneKey MCP Router Doc](https://www.deepnlp.org/doc/onekey_mcp_router) | https://agent.deepnlp.org/mcp | `onekey mcp` |
|
|
19
|
+
| LLM | Allow your AI clients to call LLM endpoint proxy [OneKey LLM Router Doc](https://www.deepnlp.org/doc/onekey_llm_router) | https://agent.deepnlp.org/llm | `onekey llm` |
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Architecture
|
|
23
|
+
This is an example of how onekey-gateway can help you and your AI agents to use commercial
|
|
24
|
+
API,Skills and MCPs in one single gateway.
|
|
25
|
+
|
|
26
|
+
```shell
|
|
27
|
+
┌─────────────┐
|
|
28
|
+
│ Client │
|
|
29
|
+
│ (App / CLI) │
|
|
30
|
+
└─────┬───────┘
|
|
31
|
+
│
|
|
32
|
+
▼
|
|
33
|
+
┌───────────────────┐
|
|
34
|
+
│ OneKey Gateway │
|
|
35
|
+
│───────────────────│
|
|
36
|
+
│ • Authentication │
|
|
37
|
+
│ • Security │
|
|
38
|
+
│ • Billing/Quotas │
|
|
39
|
+
│ • Rate Limiting │
|
|
40
|
+
└─────┬─────────────┘
|
|
41
|
+
│
|
|
42
|
+
▼
|
|
43
|
+
┌──────────────────┐
|
|
44
|
+
│ OneKey Router │
|
|
45
|
+
├──────────────────┤
|
|
46
|
+
│ • Routes requests│
|
|
47
|
+
│ • Load balances │
|
|
48
|
+
│ • Policy checks │
|
|
49
|
+
└─────┬────────────┘
|
|
50
|
+
┌────────────┼────────────┐
|
|
51
|
+
▼ ▼ ▼
|
|
52
|
+
┌────────────────┐ ┌────────────────┐ ┌────────────────┐
|
|
53
|
+
│ Agent Router │ │ MCP Router │ │ LLM Router │
|
|
54
|
+
│ (Agents / │ │ (Tools / MCPs) │ │ (LLM Providers)│
|
|
55
|
+
│ Skills) │ │ │ │ │
|
|
56
|
+
└─────┬──────────┘ └─────┬──────────┘ └─────┬──────────┘
|
|
57
|
+
│ │ │
|
|
58
|
+
▼ ▼ ▼
|
|
59
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
60
|
+
│ Execution │ │ Execution │ │ Execution │
|
|
61
|
+
│ Layer │ │ Layer │ │ Layer │
|
|
62
|
+
│ • APIs │ │ • MCP │ │ • LLM │
|
|
63
|
+
│ • Orchest │ │Servers/Tools│ │ Providers │
|
|
64
|
+
└─────┬───────┘ └─────┬───────┘ └─────┬───────┘
|
|
65
|
+
▼ ▼ ▼
|
|
66
|
+
┌──────────────────────────────────────────────┐
|
|
67
|
+
│ Provider APIs / External Services │
|
|
68
|
+
│ • LLM APIs, SaaS tools, Databases, etc. │
|
|
69
|
+
└──────────────────────────────────────────────┘
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Install
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm install @aiagenta2z/onekey-gateway
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### OneKey Access Key
|
|
79
|
+
|
|
80
|
+
**Step 1**. Get AI Agent A2Z OneKey access key
|
|
81
|
+
You can get the OneKey Gateway [Access Keys](https://deepnlp.org/workspace/keys).
|
|
82
|
+
|
|
83
|
+
**Step 2**. Set OneKey Access
|
|
84
|
+
```shell
|
|
85
|
+
export DEEPNLP_ONEKEY_ROUTER_ACCESS=your_access_key
|
|
86
|
+
```
|
|
87
|
+
For demo purpose, use the demo key for demo results.
|
|
88
|
+
|
|
89
|
+
```shell
|
|
90
|
+
export DEEPNLP_ONEKEY_ROUTER_ACCESS=BETA_TEST_KEY_MAR_2026
|
|
91
|
+
```
|
|
92
|
+
The CLI reads the access key from `DEEPNLP_ONEKEY_ROUTER_ACCESS`. If not set, it falls back to `BETA_TEST_KEY_MARCH_2026`.
|
|
93
|
+
|
|
94
|
+
## Quickstart
|
|
95
|
+
|
|
96
|
+
### OneKey CLI
|
|
97
|
+
|
|
98
|
+
#### Example 1: Google Maps
|
|
99
|
+
Your Agent will search Google Maps to find places, rankings, etc.
|
|
100
|
+
prompt: New York City Italian Restaurants
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
|
|
104
|
+
onekey agent google-maps/google-maps maps_search_places '{"query":"New York City Italian Restaurants"}'
|
|
105
|
+
```
|
|
106
|
+
Result
|
|
107
|
+
```shell
|
|
108
|
+
{"success":true,"data":"[\"{\\n \\\"places\\\": [\\n {\\n \\\"name\\\": \\\"Carmine's - Time Square\\\",\\n \\\"formatted_address\\\": \\\"200 W 44th St, New York, NY 10036, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.757498,\\n \\\"lng\\\": -73.986654\\n },\\n \\\"place_id\\\": \\\"ChIJR9So-lRYwokRX1xEjA0rChA\\\",\\n \\\"rating\\\": 4.5,\\n \\\"types\\\": [\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"Osteria La Baia\\\",\\n \\\"formatted_address\\\": \\\"129 W 52nd St, New York, NY 10019, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7618881,\\n \\\"lng\\\": -73.9809702\\n },\\n \\\"place_id\\\": \\\"ChIJo9FTvDBZwokRFAZ0i4jbLuk\\\",\\n \\\"rating\\\": 4.9,\\n \\\"types\\\": [\\n \\\"bar\\\",\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"Tony's Di Napoli\\\",\\n \\\"formatted_address\\\": \\\"147 W 43rd St, New York, NY 10036, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7564842,\\n \\\"lng\\\": -73.9853808\\n },\\n \\\"place_id\\\": \\\"ChIJVS2qI1VYwokRFo18YsKvHYM\\\",\\n \\\"rating\\\": 4.6,\\n \\\"types\\\": [\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"La Lanterna di Vittorio\\\",\\n \\\"formatted_address\\\": \\\"129 MacDougal St, New York, NY 10012, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7306651,\\n \\\"lng\\\": -74.0000496\\n },\\n \\\"place_id\\\": \\\"ChIJPxCEeZFZwokRzk5UghlXZWU\\\",\\n \\\"rating\\\": 4.5,\\n \\\"types\\\": [\\n \\\"bar\\\",\\n \\\"cafe\\\",\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"night_club\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\",\\n \\\"store\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"Scarpetta\\\",\\n \\\"formatted_address\\\": \\\"88 Madison Ave, New York, NY 10016, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.74458180000001,\\n \\\"lng\\\": -73.9856202\\n },\\n \\\"place_id\\\": \\\"ChIJt8W7n79ZwokRsyXs3QDbE3o\\\",\\n \\\"rating\\\": 4.6,\\n \\\"types\\\": [\\n \\\"bar\\\",\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"Osteria Nonnino\\\",\\n \\\"formatted_address\\\": \\\"637 Hudson St, New York, NY 10014, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7388972,\\n \\\"lng\\\": -74.0057401\\n },\\n \\\"place_id\\\": \\\"ChIJu3WF-z9ZwokRSIlFddmXX1k\\\",\\n \\\"rating\\\": 4.8,\\n \\\"types\\\": [\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"OLIO E PIÙ\\\",\\n \\\"formatted_address\\\": \\\"3 Greenwich Ave, New York, NY 10014, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7338208,\\n \\\"lng\\\": -73.99979309999999\\n },\\n \\\"place_id\\\": \\\"ChIJ_RUJvZZZwokRNUEv3K4nSik\\\",\\n \\\"rating\\\": 4.7,\\n \\\"types\\\": [\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"La Pecora Bianca SoHo\\\",\\n \\\"formatted_address\\\": \\\"54 Prince St, New York, NY 10012, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.72346,\\n \\\"lng\\\": -73.9963118\\n },\\n \\\"place_id\\\": \\\"ChIJfe6ZYKFZwokR_mHm7GNoAxc\\\",\\n \\\"rating\\\": 4.8,\\n \\\"types\\\": [\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"Osteria Barocca\\\",\\n \\\"formatted_address\\\": \\\"133 Mulberry St, New York, NY 10013, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7186467,\\n \\\"lng\\\": -73.99792409999999\\n },\\n \\\"place_id\\\": \\\"ChIJK0YQvsRZwokR9r2ubFZRd7E\\\",\\n \\\"rating\\\": 4.6,\\n \\\"types\\\": [\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"Sicily Osteria\\\",\\n \\\"formatted_address\\\": \\\"328-330 W 46th St, New York, NY 10036, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7601601,\\n \\\"lng\\\": -73.9891863\\n },\\n \\\"place_id\\\": \\\"ChIJ03krMjJZwokRYRF15upaCHw\\\",\\n \\\"rating\\\": 4.6,\\n \\\"types\\\": [\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"La Pecora Bianca NoMad\\\",\\n \\\"formatted_address\\\": \\\"1133 Broadway, New York, NY 10010, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7436754,\\n \\\"lng\\\": -73.9891719\\n },\\n \\\"place_id\\\": \\\"ChIJPf0L06VZwokRD6L-7RV-7Yg\\\",\\n \\\"rating\\\": 4.7,\\n \\\"types\\\": [\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"Da Andrea Greenwich Village\\\",\\n \\\"formatted_address\\\": \\\"35 W 13th St, New York, NY 10011, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7361918,\\n \\\"lng\\\": -73.9958515\\n },\\n \\\"place_id\\\": \\\"ChIJS1uszZRZwokRbKPTzS6hnWM\\\",\\n \\\"rating\\\": 4.6,\\n \\\"types\\\": [\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"Via Carota\\\",\\n \\\"formatted_address\\\": \\\"51 Grove St, New York, NY 10014, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7331959,\\n \\\"lng\\\": -74.00364940000001\\n },\\n \\\"place_id\\\": \\\"ChIJr7FOf5NZwokRu3CDYtzVmuQ\\\",\\n \\\"rating\\\": 4.4,\\n \\\"types\\\": [\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"Masseria Dei Vini\\\",\\n \\\"formatted_address\\\": \\\"887 9th Ave, New York, NY 10019, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7684477,\\n \\\"lng\\\": -73.9857048\\n },\\n \\\"place_id\\\": \\\"ChIJeVfr_FhYwokRVM1IjwyvQpE\\\",\\n \\\"rating\\\": 4.6,\\n \\\"types\\\": [\\n \\\"bar\\\",\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"La Masseria NY\\\",\\n \\\"formatted_address\\\": \\\"235 W 48th St, New York, NY 10036, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.76088499999999,\\n \\\"lng\\\": -73.9863\\n },\\n \\\"place_id\\\": \\\"ChIJjfIegVZYwokRyqdwvzBC27s\\\",\\n \\\"rating\\\": 4.5,\\n \\\"types\\\": [\\n \\\"bar\\\",\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"Zia Maria Little Italy\\\",\\n \\\"formatted_address\\\": \\\"138 Mulberry St, New York, NY 10013, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7187113,\\n \\\"lng\\\": -73.9975649\\n },\\n \\\"place_id\\\": \\\"ChIJm7QTo_lZwokRRnjGuJABJPQ\\\",\\n \\\"rating\\\": 4.6,\\n \\\"types\\\": [\\n \\\"bar\\\",\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\",\\n \\\"store\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"Piccola Cucina Osteria Siciliana\\\",\\n \\\"formatted_address\\\": \\\"196 Spring St, New York, NY 10012, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7250308,\\n \\\"lng\\\": -74.0032774\\n },\\n \\\"place_id\\\": \\\"ChIJowhlWYxZwokRgrvA8f_x8Es\\\",\\n \\\"rating\\\": 4.6,\\n \\\"types\\\": [\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"Trattoria Trecolori\\\",\\n \\\"formatted_address\\\": \\\"254 W 47th St, New York, NY 10036, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7599972,\\n \\\"lng\\\": -73.9867421\\n },\\n \\\"place_id\\\": \\\"ChIJYepwLVRYwokRsvXclA3XFqo\\\",\\n \\\"rating\\\": 4.5,\\n \\\"types\\\": [\\n \\\"bar\\\",\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"Don Angie\\\",\\n \\\"formatted_address\\\": \\\"103 Greenwich Ave, New York, NY 10014, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7378037,\\n \\\"lng\\\": -74.00209389999999\\n },\\n \\\"place_id\\\": \\\"ChIJfxC19JVZwokRX2uKgQAL17c\\\",\\n \\\"rating\\\": 4.6,\\n \\\"types\\\": [\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n },\\n {\\n \\\"name\\\": \\\"Casa D'Angelo New York\\\",\\n \\\"formatted_address\\\": \\\"146 Mulberry St, New York, NY 10013, USA\\\",\\n \\\"location\\\": {\\n \\\"lat\\\": 40.7188063,\\n \\\"lng\\\": -73.9972296\\n },\\n \\\"place_id\\\": \\\"ChIJCxhnSohZwokRxmUkfrQWLfs\\\",\\n \\\"rating\\\": 4.6,\\n \\\"types\\\": [\\n \\\"bar\\\",\\n \\\"establishment\\\",\\n \\\"food\\\",\\n \\\"point_of_interest\\\",\\n \\\"restaurant\\\"\\n ]\\n }\\n ]\\n}\"]","error":null}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
#### Example 2: Image Generation
|
|
113
|
+
|
|
114
|
+
model:
|
|
115
|
+
- gemini-3-pro-image-preview
|
|
116
|
+
- gemini-2.5-flash-image
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
onekey agent gemini-nano-banana/gemini-nano-banana generate_image_gemini '{"model":"gemini-2.5-flash-image", "prompt":"Generate a minecraft scene of steve fighting zombies in purple crystal fields."}'
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
{"success":true,"data":"[\"{\\n \\\"image_path\\\": \\\"/data/python/mcp_tool_use/files-wd/user_2177/7629e198-b10c-4a8b-8f61-5c0a6744cab0/gemini_output_images.png\\\",\\n \\\"image_url\\\": \\\"https://us-static.aiagenta2z.com/local/files-wd/user_2177/7629e198-b10c-4a8b-8f61-5c0a6744cab0/gemini_output_images.png\\\",\\n \\\"message\\\": \\\"\\\",\\n \\\"success\\\": true\\n}\"]","error":null}
|
|
124
|
+
## url of image generated
|
|
125
|
+
https://us-static.aiagenta2z.com/local/files-wd/user_2177/7629e198-b10c-4a8b-8f61-5c0a6744cab0/gemini_output_images.png
|
|
126
|
+
```
|
|
127
|
+
**Return Image URL Result**
|
|
128
|
+
|
|
129
|
+
<img src="https://raw.githubusercontent.com/aiagenta2z/onekey-agent-router/refs/heads/main/docs/onekey-gateway-example-gemini.jpg" style="width:500px" alt="Image generation">
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
## Tutorial
|
|
133
|
+
|
|
134
|
+
### CLI Usage
|
|
135
|
+
```bash
|
|
136
|
+
onekey agent <unique_id> <api_id> <data_json|@file>
|
|
137
|
+
onekey mcp <server_name> [--name config_name]
|
|
138
|
+
onekey llm --provider <provider> --model <model> --messages <json|@file> [--temperature <num>] [--response-format <format>] [--options <json|@file>]
|
|
139
|
+
onekey llm --payload <json|@file>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Supported ids can be found in the table below.
|
|
143
|
+
|
|
144
|
+
### OneKey Agent API
|
|
145
|
+
|
|
146
|
+
**CLI**
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
onekey agent google-maps/google-maps maps_search_places '{"query":"New York City Italian Restaurants"}'
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Skills**
|
|
153
|
+
|
|
154
|
+
`agtm` package
|
|
155
|
+
```bash
|
|
156
|
+
npx agtm add https://github.com/aiagenta2z/onekey-gateway ## add all onekey router skills
|
|
157
|
+
npx agtm add aiagenta2z/onekey-gateway --skill google-maps -g ## install to global path
|
|
158
|
+
```
|
|
159
|
+
`skills` package
|
|
160
|
+
```
|
|
161
|
+
npx skills add https://github.com/aiagenta2z/onekey-agent-router
|
|
162
|
+
## single skill
|
|
163
|
+
npx skills add https://github.com/aiagenta2z/onekey-agent-router --skill amap-maps-streamableHTTP
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### OneKey MCP Config
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
onekey mcp google-maps
|
|
170
|
+
```
|
|
171
|
+
Put below config into your clients
|
|
172
|
+
```shell
|
|
173
|
+
{
|
|
174
|
+
"mcpServers": {
|
|
175
|
+
"deepnlp-onekey-google-maps": {
|
|
176
|
+
"url": "https://agent.deepnlp.org/mcp?server_name=google-maps&onekey=your_access_key"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### OneKey LLM Router
|
|
183
|
+
Call Gemini 3 LLM and Image Nano Banana model
|
|
184
|
+
```bash
|
|
185
|
+
onekey llm --provider gemini --model gemini-3-flash-preview --messages @messages.json --temperature 0.7 --response-format json
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Gateway Categories
|
|
189
|
+
|
|
190
|
+
| Domain | Unique Id | Skill ID | API ID |
|
|
191
|
+
|----------------------|----------------------------------------------------------------------------------------------------|--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
192
|
+
| Map (Google) | google-maps/google-maps [Doc](./docs/google-maps/README.md) | google-maps | maps_directions<br>maps_distance_matrix<br>maps_elevation<br>maps_geocode<br>maps_place_details<br>maps_reverse_geocode<br>maps_search_places |
|
|
193
|
+
| Map (Amap/Gaode Map) | amap-maps-streamableHTTP/amap-maps-streamableHTTP [Doc](./docs/amap-maps-streamableHTTP/README.md) | amap-maps-streamableHTTP | maps_around_search<br>maps_direction_bicycling<br>maps_direction_driving<br>maps_direction_transit_integrated<br>maps_direction_walking<br>maps_distance<br>maps_geo<br>maps_ip_location<br>maps_regeocode<br>maps_schema_navi<br>maps_schema_personal_map<br>maps_schema_take_taxi<br>maps_search_detail<br>maps_text_search<br>maps_weather |
|
|
194
|
+
| Map (Baidu) | baidu-maps-sse/baidu-maps-sse [Doc](./docs/baidu-maps-sse/README.md) | baidu-maps-sse | maps_directions<br>maps_distance_matrix<br>maps_elevation<br>maps_geocode<br>maps_place_details<br>maps_reverse_geocode<br>maps_search_places |
|
|
195
|
+
| Image Search | bing-image-search-mcp/bing-image-search-mcp [Doc](./docs/bing-image-search-mcp/README.md) | bing-image-search-mcp | search_images<br>search_images_batch |
|
|
196
|
+
| Web Search | brave-search/brave-search [Doc](./docs/brave-search/README.md) | brave-search | brave_local_search<br>brave_web_search |
|
|
197
|
+
| Web Search | google-search/google-search [Doc](./docs/google-search/README.md) | google-search | google_search |
|
|
198
|
+
| Web Search | tavily-remote-mcp/tavily-remote-mcp [Doc](./docs/tavily-remote-mcp/README.md) | tavily-remote-mcp | tavily_crawl<br>tavily_extract<br>tavily_map<br>tavily_research<br>tavily_search |
|
|
199
|
+
| Web Crawl / Browser | firecrawl-mcp/firecrawl-mcp [Doc](./docs/firecrawl-mcp/README.md) | firecrawl-mcp | firecrawl_agent<br>firecrawl_agent_status<br>firecrawl_browser_create<br>firecrawl_browser_delete<br>firecrawl_browser_execute<br>firecrawl_browser_list<br>firecrawl_check_crawl_status<br>firecrawl_crawl<br>firecrawl_extract<br>firecrawl_map<br>firecrawl_scrape<br>firecrawl_search |
|
|
200
|
+
| Image Generation | gemini/gemini [Doc](./docs/gemini/README.md) | gemini (Nano Banana) | generate_image_gemini<br>generate_image_nano_banana<br>generate_image_nano_banana_with_reference<br>ocr_extract_text_from_image<br>list_items_from_image |
|
|
201
|
+
| Image Generation | gemini-nano-banana/gemini-nano-banana [Doc](./docs/gemini-nano-banana/README.md) | gemini-nano-banana | generate_image_gemini<br>generate_image_nano_banana<br>generate_image_nano_banana_with_reference<br>ocr_extract_text_from_image<br>list_items_from_image |
|
|
202
|
+
| Charts | mcp-server-chart/mcp-server-chart [Doc](./docs/mcp-server-chart/README.md) | mcp-server-chart | generate_area_chart<br>generate_bar_chart<br>generate_boxplot_chart<br>generate_column_chart<br>generate_district_map<br>generate_dual_axes_chart<br>generate_fishbone_diagram<br>generate_flow_diagram<br>generate_funnel_chart<br>generate_histogram_chart<br>generate_line_chart<br>generate_liquid_chart<br>generate_mind_map<br>generate_network_graph<br>generate_organization_chart<br>generate_path_map<br>generate_pie_chart<br>generate_pin_map<br>generate_radar_chart<br>generate_sankey_chart<br>generate_scatter_chart<br>generate_spreadsheet<br>generate_treemap_chart<br>generate_venn_chart<br>generate_violin_chart<br>generate_waterfall_chart<br>generate_word_cloud_chart |
|
|
203
|
+
| Research QA | perplexity/perplexity [Doc](./docs/perplexity/README.md) | perplexity | perplexity_ask<br>perplexity_reason<br>perplexity_research<br>perplexity_search |
|
|
204
|
+
| 3D Generation | craftsman-agent/craftsman-agent [Doc](./docs/craftsman-agent/README.md) | craftsman-agent | generate_lego_build_plan<br>generate_minecraft_build_plan |
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
#### Example 1: Google Maps Search
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
onekey agent google-maps/google-maps maps_search_places '{"query":"New York City Italian Restaurants"}'
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
curl -X POST "https://agent.deepnlp.org/agent_router" \
|
|
215
|
+
-H "Content-Type: application/json" \
|
|
216
|
+
-H "X-OneKey: $DEEPNLP_ONEKEY_ROUTER_ACCESS" \
|
|
217
|
+
-d '{
|
|
218
|
+
"unique_id": "google-maps/google-maps",
|
|
219
|
+
"api_id": "maps_search_places",
|
|
220
|
+
"data": {
|
|
221
|
+
"query": "New York City Italian Restaurants"
|
|
222
|
+
}
|
|
223
|
+
}'
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
#### Example 2: Image Generation
|
|
227
|
+
|
|
228
|
+
model:
|
|
229
|
+
- gemini-3-pro-image-preview
|
|
230
|
+
- gemini-2.5-flash-image
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
onekey agent gemini-nano-banana/gemini-nano-banana generate_image_gemini '{"model":"gemini-2.5-flash-image", "prompt":"Generate a minecraft scene of steve fighting zombies in purple crystal fields."}'
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
{"success":true,"data":"[\"{\\n \\\"image_path\\\": \\\"/data/python/mcp_tool_use/files-wd/user_2177/7629e198-b10c-4a8b-8f61-5c0a6744cab0/gemini_output_images.png\\\",\\n \\\"image_url\\\": \\\"https://us-static.aiagenta2z.com/local/files-wd/user_2177/7629e198-b10c-4a8b-8f61-5c0a6744cab0/gemini_output_images.png\\\",\\n \\\"message\\\": \\\"\\\",\\n \\\"success\\\": true\\n}\"]","error":null}
|
|
238
|
+
|
|
239
|
+
## Return Image url:
|
|
240
|
+
https://us-static.aiagenta2z.com/local/files-wd/user_2177/7629e198-b10c-4a8b-8f61-5c0a6744cab0/gemini_output_images.png
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
### Related
|
|
245
|
+
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const client_1 = require("./client");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
function parseArgs(argv) {
|
|
7
|
+
const flags = {};
|
|
8
|
+
const positionals = [];
|
|
9
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
10
|
+
const arg = argv[i];
|
|
11
|
+
if (!arg)
|
|
12
|
+
continue;
|
|
13
|
+
if (arg.startsWith("--")) {
|
|
14
|
+
const [key, inlineValue] = arg.slice(2).split("=", 2);
|
|
15
|
+
if (inlineValue !== undefined) {
|
|
16
|
+
flags[key] = inlineValue;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
const next = argv[i + 1];
|
|
20
|
+
if (!next || next.startsWith("-")) {
|
|
21
|
+
flags[key] = true;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
flags[key] = next;
|
|
25
|
+
i += 1;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (arg.startsWith("-")) {
|
|
29
|
+
flags[arg.slice(1)] = true;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
positionals.push(arg);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
command: positionals.shift(),
|
|
36
|
+
positionals,
|
|
37
|
+
flags
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function readMaybeFile(input) {
|
|
41
|
+
if (input.startsWith("@")) {
|
|
42
|
+
const path = input.slice(1);
|
|
43
|
+
return (0, fs_1.readFileSync)(path, "utf-8");
|
|
44
|
+
}
|
|
45
|
+
return input;
|
|
46
|
+
}
|
|
47
|
+
function parseJsonInput(input, label) {
|
|
48
|
+
const raw = readMaybeFile(input);
|
|
49
|
+
try {
|
|
50
|
+
return JSON.parse(raw);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
54
|
+
throw new Error(`Failed to parse ${label} JSON: ${message}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function resolveAccessKey(flags) {
|
|
58
|
+
const keyFlag = flags.key;
|
|
59
|
+
if (typeof keyFlag === "string" && keyFlag.trim().length > 0) {
|
|
60
|
+
return keyFlag;
|
|
61
|
+
}
|
|
62
|
+
const envKey = process.env.DEEPNLP_ONEKEY_ROUTER_ACCESS;
|
|
63
|
+
if (envKey && envKey.trim().length > 0) {
|
|
64
|
+
return envKey;
|
|
65
|
+
}
|
|
66
|
+
return client_1.constants.DEFAULT_ACCESS_KEY;
|
|
67
|
+
}
|
|
68
|
+
function warnIfUsingDefault(accessKey, flags) {
|
|
69
|
+
const keyFlag = flags.key;
|
|
70
|
+
const envKey = process.env.DEEPNLP_ONEKEY_ROUTER_ACCESS;
|
|
71
|
+
if (!keyFlag && !envKey) {
|
|
72
|
+
process.stderr.write("Using default test key (BETA_TEST_KEY_MARCH_2026). Set DEEPNLP_ONEKEY_ROUTER_ACCESS or pass --key to override.\n");
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function printHelp() {
|
|
76
|
+
const text = `OneKey Gateway CLI
|
|
77
|
+
|
|
78
|
+
Usage:
|
|
79
|
+
onekey agent <unique_id> <api_id> <data_json|@file>
|
|
80
|
+
onekey mcp <server_name> [--name config_name]
|
|
81
|
+
onekey llm --provider <provider> --model <model> --messages <json|@file> [--temperature <num>] [--response-format <format>] [--options <json|@file>]
|
|
82
|
+
onekey llm --payload <json|@file>
|
|
83
|
+
|
|
84
|
+
Flags:
|
|
85
|
+
--key <access_key> Override DEEPNLP_ONEKEY_ROUTER_ACCESS
|
|
86
|
+
--help Show help
|
|
87
|
+
|
|
88
|
+
Examples:
|
|
89
|
+
onekey agent google-maps/google-maps maps_search_places '{"query":"New York City Italian Restaurants"}'
|
|
90
|
+
onekey mcp google-maps
|
|
91
|
+
onekey llm --provider gemini --model gemini-3-flash-preview --messages @messages.json --temperature 0.7 --response-format json
|
|
92
|
+
`;
|
|
93
|
+
process.stdout.write(text);
|
|
94
|
+
}
|
|
95
|
+
async function runAgent(positionals, flags) {
|
|
96
|
+
const [uniqueId, apiId, dataInput] = positionals;
|
|
97
|
+
if (!uniqueId || !apiId || !dataInput) {
|
|
98
|
+
throw new Error("agent requires <unique_id> <api_id> <data_json|@file>");
|
|
99
|
+
}
|
|
100
|
+
const accessKey = resolveAccessKey(flags);
|
|
101
|
+
warnIfUsingDefault(accessKey, flags);
|
|
102
|
+
const data = parseJsonInput(dataInput, "data");
|
|
103
|
+
const result = await (0, client_1.agentRouter)({
|
|
104
|
+
unique_id: uniqueId,
|
|
105
|
+
api_id: apiId,
|
|
106
|
+
data
|
|
107
|
+
}, accessKey);
|
|
108
|
+
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
109
|
+
}
|
|
110
|
+
async function runMcp(positionals, flags) {
|
|
111
|
+
const [serverName] = positionals;
|
|
112
|
+
if (!serverName) {
|
|
113
|
+
throw new Error("mcp requires <server_name>");
|
|
114
|
+
}
|
|
115
|
+
const accessKey = resolveAccessKey(flags);
|
|
116
|
+
warnIfUsingDefault(accessKey, flags);
|
|
117
|
+
const configName = typeof flags.name === "string" ? flags.name : undefined;
|
|
118
|
+
const config = (0, client_1.buildMcpConfig)({
|
|
119
|
+
serverName,
|
|
120
|
+
accessKey,
|
|
121
|
+
configName
|
|
122
|
+
});
|
|
123
|
+
process.stdout.write(`${JSON.stringify(config, null, 2)}\n`);
|
|
124
|
+
}
|
|
125
|
+
async function runLlm(positionals, flags) {
|
|
126
|
+
// const [requestId] = positionals;
|
|
127
|
+
// if (!requestId) {
|
|
128
|
+
// throw new Error("llm requires <request_id>");
|
|
129
|
+
// }
|
|
130
|
+
const accessKey = resolveAccessKey(flags);
|
|
131
|
+
warnIfUsingDefault(accessKey, flags);
|
|
132
|
+
let payload;
|
|
133
|
+
if (typeof flags.payload === "string") {
|
|
134
|
+
payload = parseJsonInput(flags.payload, "payload");
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
const provider = flags.provider;
|
|
138
|
+
const model = flags.model;
|
|
139
|
+
const messagesInput = flags.messages;
|
|
140
|
+
if (typeof provider !== "string" || typeof model !== "string" || typeof messagesInput !== "string") {
|
|
141
|
+
throw new Error("llm requires --provider, --model, and --messages unless --payload is provided");
|
|
142
|
+
}
|
|
143
|
+
const messages = parseJsonInput(messagesInput, "messages");
|
|
144
|
+
payload = {
|
|
145
|
+
provider,
|
|
146
|
+
model,
|
|
147
|
+
messages
|
|
148
|
+
};
|
|
149
|
+
if (typeof flags.temperature === "string") {
|
|
150
|
+
const temp = Number(flags.temperature);
|
|
151
|
+
if (Number.isNaN(temp)) {
|
|
152
|
+
throw new Error("--temperature must be a number");
|
|
153
|
+
}
|
|
154
|
+
payload.temperature = temp;
|
|
155
|
+
}
|
|
156
|
+
if (typeof flags["response-format"] === "string") {
|
|
157
|
+
payload.response_format = flags["response-format"];
|
|
158
|
+
}
|
|
159
|
+
if (typeof flags.response_format === "string") {
|
|
160
|
+
payload.response_format = flags.response_format;
|
|
161
|
+
}
|
|
162
|
+
if (typeof flags.options === "string") {
|
|
163
|
+
const options = parseJsonInput(flags.options, "options");
|
|
164
|
+
payload = {
|
|
165
|
+
...payload,
|
|
166
|
+
...options
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// payload.request_id = requestId;
|
|
171
|
+
const result = await (0, client_1.llmRouter)(payload, accessKey);
|
|
172
|
+
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
173
|
+
}
|
|
174
|
+
async function main() {
|
|
175
|
+
const parsed = parseArgs(process.argv.slice(2));
|
|
176
|
+
const { command, positionals, flags } = parsed;
|
|
177
|
+
if (!command || flags.help || flags.h) {
|
|
178
|
+
printHelp();
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
switch (command) {
|
|
183
|
+
case "agent":
|
|
184
|
+
await runAgent(positionals, flags);
|
|
185
|
+
return;
|
|
186
|
+
case "mcp":
|
|
187
|
+
await runMcp(positionals, flags);
|
|
188
|
+
return;
|
|
189
|
+
case "llm":
|
|
190
|
+
await runLlm(positionals, flags);
|
|
191
|
+
return;
|
|
192
|
+
default:
|
|
193
|
+
throw new Error(`Unknown command: ${command}`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
198
|
+
process.stderr.write(`${message}\n`);
|
|
199
|
+
process.exit(1);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
void main();
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type RouterResponse<T = unknown> = {
|
|
2
|
+
success: boolean;
|
|
3
|
+
data: T;
|
|
4
|
+
error: string | null;
|
|
5
|
+
};
|
|
6
|
+
export type AgentRequest = {
|
|
7
|
+
unique_id: string;
|
|
8
|
+
api_id: string;
|
|
9
|
+
data: unknown;
|
|
10
|
+
};
|
|
11
|
+
export type LlmMessage = {
|
|
12
|
+
role: string;
|
|
13
|
+
content: string;
|
|
14
|
+
};
|
|
15
|
+
export type LlmRequest = {
|
|
16
|
+
provider: string;
|
|
17
|
+
model: string;
|
|
18
|
+
messages: LlmMessage[];
|
|
19
|
+
temperature?: number;
|
|
20
|
+
response_format?: string;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
};
|
|
23
|
+
export type McpConfigOptions = {
|
|
24
|
+
serverName: string;
|
|
25
|
+
accessKey?: string;
|
|
26
|
+
configName?: string;
|
|
27
|
+
};
|
|
28
|
+
export declare function agentRouter(request: AgentRequest, accessKey?: string): Promise<RouterResponse>;
|
|
29
|
+
export declare function llmRouter(request: LlmRequest, accessKey?: string): Promise<RouterResponse>;
|
|
30
|
+
export declare function buildMcpConfig(options: McpConfigOptions): {
|
|
31
|
+
mcpServers: {
|
|
32
|
+
[x: string]: {
|
|
33
|
+
url: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export declare const constants: {
|
|
38
|
+
AGENT_ROUTER_URL: string;
|
|
39
|
+
MCP_ROUTER_BASE_URL: string;
|
|
40
|
+
LLM_ROUTER_URL: string;
|
|
41
|
+
DEFAULT_ACCESS_KEY: string;
|
|
42
|
+
};
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constants = void 0;
|
|
4
|
+
exports.agentRouter = agentRouter;
|
|
5
|
+
exports.llmRouter = llmRouter;
|
|
6
|
+
exports.buildMcpConfig = buildMcpConfig;
|
|
7
|
+
const DEFAULT_ACCESS_KEY = "BETA_TEST_KEY_MARCH_2026";
|
|
8
|
+
const AGENT_ROUTER_URL = "https://agent.deepnlp.org/agent_router";
|
|
9
|
+
const MCP_ROUTER_BASE_URL = "https://agent.deepnlp.org/mcp";
|
|
10
|
+
const LLM_ROUTER_URL = "https://agent.deepnlp.org/llm";
|
|
11
|
+
function resolveAccessKey(accessKey) {
|
|
12
|
+
return accessKey && accessKey.trim().length > 0 ? accessKey : DEFAULT_ACCESS_KEY;
|
|
13
|
+
}
|
|
14
|
+
async function postJson(url, body, accessKey) {
|
|
15
|
+
const key = resolveAccessKey(accessKey);
|
|
16
|
+
const response = await fetch(url, {
|
|
17
|
+
method: "POST",
|
|
18
|
+
headers: {
|
|
19
|
+
"Content-Type": "application/json",
|
|
20
|
+
"X-OneKey": key
|
|
21
|
+
},
|
|
22
|
+
body: JSON.stringify(body)
|
|
23
|
+
});
|
|
24
|
+
const text = await response.text();
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(text);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return {
|
|
30
|
+
success: false,
|
|
31
|
+
data: text,
|
|
32
|
+
error: "Non-JSON response"
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function agentRouter(request, accessKey) {
|
|
37
|
+
return postJson(AGENT_ROUTER_URL, request, accessKey);
|
|
38
|
+
}
|
|
39
|
+
async function llmRouter(request, accessKey) {
|
|
40
|
+
return postJson(LLM_ROUTER_URL, request, accessKey);
|
|
41
|
+
}
|
|
42
|
+
function buildMcpConfig(options) {
|
|
43
|
+
const key = resolveAccessKey(options.accessKey);
|
|
44
|
+
const name = options.configName ?? `deepnlp-onekey-${options.serverName}`;
|
|
45
|
+
const url = `${MCP_ROUTER_BASE_URL}?server_name=${encodeURIComponent(options.serverName)}&onekey=${encodeURIComponent(key)}`;
|
|
46
|
+
return {
|
|
47
|
+
mcpServers: {
|
|
48
|
+
[name]: {
|
|
49
|
+
url
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
exports.constants = {
|
|
55
|
+
AGENT_ROUTER_URL,
|
|
56
|
+
MCP_ROUTER_BASE_URL,
|
|
57
|
+
LLM_ROUTER_URL,
|
|
58
|
+
DEFAULT_ACCESS_KEY
|
|
59
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { agentRouter, llmRouter, buildMcpConfig, type AgentRequest, type LlmRequest, type McpConfigOptions, type RouterResponse } from "./client";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildMcpConfig = exports.llmRouter = exports.agentRouter = void 0;
|
|
4
|
+
var client_1 = require("./client");
|
|
5
|
+
Object.defineProperty(exports, "agentRouter", { enumerable: true, get: function () { return client_1.agentRouter; } });
|
|
6
|
+
Object.defineProperty(exports, "llmRouter", { enumerable: true, get: function () { return client_1.llmRouter; } });
|
|
7
|
+
Object.defineProperty(exports, "buildMcpConfig", { enumerable: true, get: function () { return client_1.buildMcpConfig; } });
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aiagenta2z/onekey-gateway",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OneKey Gateway CLI and SDK for routing AI agent, MCP, and LLM requests.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "aiagenta2z",
|
|
7
|
+
"type": "commonjs",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"bin": {
|
|
11
|
+
"onekey": "dist/cli.js"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc -p tsconfig.json",
|
|
18
|
+
"dev": "tsc -p tsconfig.json --watch",
|
|
19
|
+
"clean": "rm -rf dist"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^25.5.0",
|
|
23
|
+
"typescript": "^5.5.4"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=18"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"onekey",
|
|
30
|
+
"gateway",
|
|
31
|
+
"agent",
|
|
32
|
+
"mcp",
|
|
33
|
+
"llm",
|
|
34
|
+
"router"
|
|
35
|
+
]
|
|
36
|
+
}
|