@infrgate/botchain-sdk 0.1.0 → 1.0.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.
- package/README.md +44 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +21 -15
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @infrgate/botchain-sdk
|
|
2
|
+
|
|
3
|
+
The official TypeScript/JavaScript SDK for **InfrGate** — the decentralized Web3 AI Agent Gateway built for BOT Chain.
|
|
4
|
+
|
|
5
|
+
This SDK allows you to easily connect to your InfrGate AI Proxy and perform streaming LLM inference (e.g. Google Gemini, OpenAI, Anthropic) using your Web3-provisioned API keys.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @infrgate/botchain-sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { Infrgate } from "@infrgate/botchain-sdk";
|
|
17
|
+
|
|
18
|
+
// Initialize the SDK.
|
|
19
|
+
// By default, this connects to the InfrGate production cluster.
|
|
20
|
+
const ai = new Infrgate({
|
|
21
|
+
apiKey: "sk-infr_YOUR_API_KEY", // Get this from the InfrGate dApp after subscribing
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
async function main() {
|
|
25
|
+
// Standard OpenAI-compatible Chat Completions
|
|
26
|
+
const response = await ai.chat.completions.create({
|
|
27
|
+
model: "Qwen/Qwen2.5-72B-Instruct", // Or any supported model
|
|
28
|
+
messages: [{ role: "user", content: "What is BOT Chain?" }],
|
|
29
|
+
stream: false,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
console.log(response.choices[0].message.content);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
main();
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
- **OpenAI Compatible:** The SDK interface is 100% compatible with the official OpenAI SDK structure, making migration completely seamless.
|
|
40
|
+
- **Streaming Support:** Fully supports SSE (Server-Sent Events) for real-time text streaming.
|
|
41
|
+
- **Web3 Native:** Connects to the decentralized InfrGate infrastructure, where token limits are strictly enforced by your on-chain BOT Chain subscription.
|
|
42
|
+
|
|
43
|
+
## Support
|
|
44
|
+
For issues or feature requests, please visit the [InfrGate GitHub Repository](https://github.com/Iam-jayant/Infrgate-web3) or access the dApp at [infrgate-web3.vercel.app](https://infrgate-web3.vercel.app/).
|
package/dist/index.js
CHANGED
|
@@ -116,7 +116,7 @@ var Infrgate = class {
|
|
|
116
116
|
chat;
|
|
117
117
|
constructor(options = {}) {
|
|
118
118
|
this.apiKey = options.apiKey || process.env.INFRGATE_API_KEY || "";
|
|
119
|
-
this.baseURL = (options.baseURL || process.env.INFRGATE_BASE_URL || "https://
|
|
119
|
+
this.baseURL = (options.baseURL || process.env.INFRGATE_BASE_URL || "https://infrgate.onrender.com/v1").replace(/\/+$/, "");
|
|
120
120
|
this.timeout = options.timeout || 6e4;
|
|
121
121
|
this.chat = new Chat(this);
|
|
122
122
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -88,7 +88,7 @@ var Infrgate = class {
|
|
|
88
88
|
chat;
|
|
89
89
|
constructor(options = {}) {
|
|
90
90
|
this.apiKey = options.apiKey || process.env.INFRGATE_API_KEY || "";
|
|
91
|
-
this.baseURL = (options.baseURL || process.env.INFRGATE_BASE_URL || "https://
|
|
91
|
+
this.baseURL = (options.baseURL || process.env.INFRGATE_BASE_URL || "https://infrgate.onrender.com/v1").replace(/\/+$/, "");
|
|
92
92
|
this.timeout = options.timeout || 6e4;
|
|
93
93
|
this.chat = new Chat(this);
|
|
94
94
|
}
|
package/package.json
CHANGED
|
@@ -1,33 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infrgate/botchain-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "TypeScript SDK for Infrgate AI Gateway on BOT Chain",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md"
|
|
11
11
|
],
|
|
12
12
|
"exports": {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.mjs",
|
|
16
|
+
"require": "./dist/index.js"
|
|
17
|
+
}
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
22
22
|
},
|
|
23
|
-
"keywords": [
|
|
23
|
+
"keywords": [
|
|
24
|
+
"ai",
|
|
25
|
+
"agents",
|
|
26
|
+
"botchain",
|
|
27
|
+
"llm-gateway",
|
|
28
|
+
"infrgate"
|
|
29
|
+
],
|
|
24
30
|
"author": "",
|
|
25
31
|
"license": "MIT",
|
|
26
32
|
"devDependencies": {
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
"tsup": "^8.0.2",
|
|
34
|
+
"typescript": "^5.4.0"
|
|
29
35
|
},
|
|
30
36
|
"engines": {
|
|
31
|
-
|
|
37
|
+
"node": ">=18.0.0"
|
|
32
38
|
}
|
|
33
|
-
|
|
39
|
+
}
|