@bridgenode/llm 0.1.0 → 0.2.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 +62 -1396
- package/dist/index.cjs +22 -22
- package/dist/index.d.cts +73 -73
- package/dist/index.d.ts +73 -73
- package/dist/index.js +22 -22
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -472,7 +472,7 @@ var LLMClient = class _LLMClient {
|
|
|
472
472
|
preAuthCache = /* @__PURE__ */ new Map();
|
|
473
473
|
static PRE_AUTH_TTL_MS = 36e5;
|
|
474
474
|
/**
|
|
475
|
-
* Initialize the
|
|
475
|
+
* Initialize the BridgeNode LLM client.
|
|
476
476
|
*
|
|
477
477
|
* @param options - Client configuration options (optional if BASE_CHAIN_WALLET_KEY env var is set)
|
|
478
478
|
*/
|
|
@@ -819,7 +819,7 @@ var LLMClient = class _LLMClient {
|
|
|
819
819
|
details.resource?.url || `${this.apiUrl}/v1/chat/completions`,
|
|
820
820
|
this.apiUrl
|
|
821
821
|
),
|
|
822
|
-
resourceDescription: details.resource?.description || "
|
|
822
|
+
resourceDescription: details.resource?.description || "BridgeNode AI API call",
|
|
823
823
|
maxTimeoutSeconds: details.maxTimeoutSeconds || 300,
|
|
824
824
|
extra: details.extra,
|
|
825
825
|
extensions
|
|
@@ -904,7 +904,7 @@ var LLMClient = class _LLMClient {
|
|
|
904
904
|
details.resource?.url || `${this.apiUrl}/v1/chat/completions`,
|
|
905
905
|
this.apiUrl
|
|
906
906
|
),
|
|
907
|
-
resourceDescription: details.resource?.description || "
|
|
907
|
+
resourceDescription: details.resource?.description || "BridgeNode AI API call",
|
|
908
908
|
maxTimeoutSeconds: details.maxTimeoutSeconds || 300,
|
|
909
909
|
extra: details.extra,
|
|
910
910
|
extensions
|
|
@@ -1095,7 +1095,7 @@ var LLMClient = class _LLMClient {
|
|
|
1095
1095
|
details.resource?.url || url,
|
|
1096
1096
|
this.apiUrl
|
|
1097
1097
|
),
|
|
1098
|
-
resourceDescription: details.resource?.description || "
|
|
1098
|
+
resourceDescription: details.resource?.description || "BridgeNode AI API call",
|
|
1099
1099
|
maxTimeoutSeconds: details.maxTimeoutSeconds || 300,
|
|
1100
1100
|
extra: details.extra,
|
|
1101
1101
|
extensions
|
|
@@ -1242,7 +1242,7 @@ var LLMClient = class _LLMClient {
|
|
|
1242
1242
|
details.resource?.url || url,
|
|
1243
1243
|
this.apiUrl
|
|
1244
1244
|
),
|
|
1245
|
-
resourceDescription: details.resource?.description || "
|
|
1245
|
+
resourceDescription: details.resource?.description || "BridgeNode AI API call",
|
|
1246
1246
|
maxTimeoutSeconds: details.maxTimeoutSeconds || 300,
|
|
1247
1247
|
extra: details.extra,
|
|
1248
1248
|
extensions
|
|
@@ -1698,7 +1698,7 @@ var LLMClient = class _LLMClient {
|
|
|
1698
1698
|
// 0x DEX (swap quotes + gasless) — free passthrough
|
|
1699
1699
|
// ============================================================
|
|
1700
1700
|
/**
|
|
1701
|
-
* Query the 0x Swap / Gasless APIs (free — no x402 payment;
|
|
1701
|
+
* Query the 0x Swap / Gasless APIs (free — no x402 payment; BridgeNode
|
|
1702
1702
|
* takes an on-chain affiliate fee on executed swaps instead).
|
|
1703
1703
|
*
|
|
1704
1704
|
* @param path - "price", "quote", "gasless/price", "gasless/quote",
|
|
@@ -1812,7 +1812,7 @@ var ImageClient = class {
|
|
|
1812
1812
|
sessionTotalUsd = 0;
|
|
1813
1813
|
sessionCalls = 0;
|
|
1814
1814
|
/**
|
|
1815
|
-
* Initialize the
|
|
1815
|
+
* Initialize the BridgeNode Image client.
|
|
1816
1816
|
*
|
|
1817
1817
|
* @param options - Client configuration options
|
|
1818
1818
|
*/
|
|
@@ -2313,7 +2313,7 @@ var SpeechClient = class {
|
|
|
2313
2313
|
* @returns SpeechResponse with audio URL, format, and character count
|
|
2314
2314
|
*
|
|
2315
2315
|
* @example
|
|
2316
|
-
* const result = await client.generate('Welcome to
|
|
2316
|
+
* const result = await client.generate('Welcome to BridgeNode.', { voice: 'george' });
|
|
2317
2317
|
* console.log(result.data[0].url); // audio URL (mp3 by default)
|
|
2318
2318
|
*/
|
|
2319
2319
|
async generate(input, options) {
|
|
@@ -3302,7 +3302,7 @@ var PortraitClient = class {
|
|
|
3302
3302
|
details.network || "eip155:8453",
|
|
3303
3303
|
{
|
|
3304
3304
|
resourceUrl: details.resource?.url || url,
|
|
3305
|
-
resourceDescription: details.resource?.description || "
|
|
3305
|
+
resourceDescription: details.resource?.description || "BridgeNode Virtual Portrait",
|
|
3306
3306
|
maxTimeoutSeconds: details.maxTimeoutSeconds || 300,
|
|
3307
3307
|
extra: details.extra
|
|
3308
3308
|
}
|
|
@@ -4106,14 +4106,14 @@ var RpcClient = class {
|
|
|
4106
4106
|
}
|
|
4107
4107
|
};
|
|
4108
4108
|
|
|
4109
|
-
// src/
|
|
4109
|
+
// src/bridgenode.ts
|
|
4110
4110
|
import { privateKeyToAccount as privateKeyToAccount13 } from "viem/accounts";
|
|
4111
4111
|
var DEFAULT_API_URL13 = "https://bridgenode.cc/api";
|
|
4112
4112
|
var DEFAULT_TIMEOUT13 = 6e4;
|
|
4113
4113
|
var DEFAULT_POLL_INTERVAL_MS = 5e3;
|
|
4114
4114
|
var DEFAULT_POLL_BUDGET_MS = 3e5;
|
|
4115
4115
|
var MAX_SIGNED_AUTH_SECONDS = 600;
|
|
4116
|
-
var
|
|
4116
|
+
var BridgeNodeClient = class {
|
|
4117
4117
|
account;
|
|
4118
4118
|
privateKey;
|
|
4119
4119
|
apiUrl;
|
|
@@ -4137,7 +4137,7 @@ var BlockrunClient = class {
|
|
|
4137
4137
|
this.timeout = options.timeout || DEFAULT_TIMEOUT13;
|
|
4138
4138
|
}
|
|
4139
4139
|
/**
|
|
4140
|
-
* GET a
|
|
4140
|
+
* GET a BridgeNode endpoint. `path` is everything after `/api` (a leading
|
|
4141
4141
|
* `/api` is tolerated and stripped). Query params are URL-encoded; arrays
|
|
4142
4142
|
* become repeated keys (`?a=1&a=2`); undefined/null are dropped.
|
|
4143
4143
|
*/
|
|
@@ -4146,7 +4146,7 @@ var BlockrunClient = class {
|
|
|
4146
4146
|
return this.requestWithPayment(url, "GET");
|
|
4147
4147
|
}
|
|
4148
4148
|
/**
|
|
4149
|
-
* POST a
|
|
4149
|
+
* POST a BridgeNode endpoint with a JSON body.
|
|
4150
4150
|
*/
|
|
4151
4151
|
async post(path5, body) {
|
|
4152
4152
|
const url = this.buildUrl(path5);
|
|
@@ -4603,12 +4603,12 @@ function formatWalletMigrationNotice(newAddress) {
|
|
|
4603
4603
|
if (addresses.length === 0) return null;
|
|
4604
4604
|
const found = addresses.map((addr) => ` ${addr}`).join("\n");
|
|
4605
4605
|
return `
|
|
4606
|
-
NOTICE:
|
|
4606
|
+
NOTICE: BridgeNode created a new wallet, but also found existing wallet(s)
|
|
4607
4607
|
belonging to other applications on this system:
|
|
4608
4608
|
|
|
4609
4609
|
${found}
|
|
4610
4610
|
|
|
4611
|
-
|
|
4611
|
+
BridgeNode now uses only its own wallet:
|
|
4612
4612
|
|
|
4613
4613
|
${newAddress}
|
|
4614
4614
|
|
|
@@ -4618,7 +4618,7 @@ do not control.
|
|
|
4618
4618
|
|
|
4619
4619
|
If an address above is yours and holds your USDC, adopt it deliberately:
|
|
4620
4620
|
|
|
4621
|
-
import { importWallet } from '@
|
|
4621
|
+
import { importWallet } from '@bridgenode/llm';
|
|
4622
4622
|
importWallet("<address-from-the-list-above>");
|
|
4623
4623
|
|
|
4624
4624
|
Your current wallet is backed up first. You can also set
|
|
@@ -4666,7 +4666,7 @@ function getPaymentLinks(address) {
|
|
|
4666
4666
|
function formatWalletCreatedMessage(address) {
|
|
4667
4667
|
const links = getPaymentLinks(address);
|
|
4668
4668
|
return `
|
|
4669
|
-
I'm your
|
|
4669
|
+
I'm your BridgeNode Agent! I can access GPT-4, Grok, image generation, and more.
|
|
4670
4670
|
|
|
4671
4671
|
Please send $1-5 USDC on Base to start:
|
|
4672
4672
|
|
|
@@ -4857,12 +4857,12 @@ async function formatSolanaWalletMigrationNotice(newAddress) {
|
|
|
4857
4857
|
if (addresses.length === 0) return null;
|
|
4858
4858
|
const found = addresses.map((addr) => ` ${addr}`).join("\n");
|
|
4859
4859
|
return `
|
|
4860
|
-
NOTICE:
|
|
4860
|
+
NOTICE: BridgeNode created a new Solana wallet, but also found existing
|
|
4861
4861
|
wallet(s) belonging to other applications on this system:
|
|
4862
4862
|
|
|
4863
4863
|
${found}
|
|
4864
4864
|
|
|
4865
|
-
|
|
4865
|
+
BridgeNode now uses only its own wallet:
|
|
4866
4866
|
|
|
4867
4867
|
${newAddress}
|
|
4868
4868
|
|
|
@@ -4872,7 +4872,7 @@ do not control.
|
|
|
4872
4872
|
|
|
4873
4873
|
If an address above is yours and holds your USDC, adopt it deliberately:
|
|
4874
4874
|
|
|
4875
|
-
import { importSolanaWallet } from '@
|
|
4875
|
+
import { importSolanaWallet } from '@bridgenode/llm';
|
|
4876
4876
|
await importSolanaWallet("<address-from-the-list-above>");
|
|
4877
4877
|
|
|
4878
4878
|
Your current wallet is backed up first. You can also set
|
|
@@ -5145,7 +5145,7 @@ var SolanaLLMClient = class {
|
|
|
5145
5145
|
// 0x DEX (swap quotes + gasless) — free passthrough
|
|
5146
5146
|
// ============================================================
|
|
5147
5147
|
/**
|
|
5148
|
-
* Query the 0x Swap / Gasless APIs (free — no x402 payment;
|
|
5148
|
+
* Query the 0x Swap / Gasless APIs (free — no x402 payment; BridgeNode
|
|
5149
5149
|
* takes an on-chain affiliate fee on executed swaps instead).
|
|
5150
5150
|
*
|
|
5151
5151
|
* @param path - "price", "quote", "gasless/price", "gasless/quote",
|
|
@@ -6010,7 +6010,7 @@ export {
|
|
|
6010
6010
|
APIError,
|
|
6011
6011
|
AnthropicClient,
|
|
6012
6012
|
BASE_CHAIN_ID,
|
|
6013
|
-
|
|
6013
|
+
BridgeNodeClient,
|
|
6014
6014
|
BridgeNodeError,
|
|
6015
6015
|
ImageClient,
|
|
6016
6016
|
KNOWN_PROVIDERS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bridgenode/llm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "BridgeNode SDK - Pay-per-request AI (LLM, Image, Video, Music, Voice) via x402 on Base and Solana",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"repository": {
|
|
43
43
|
"type": "git",
|
|
44
|
-
"url": "git+https://github.com/
|
|
44
|
+
"url": "git+https://github.com/applefanaimail-blip/llm"
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://bridgenode.cc",
|
|
47
47
|
"bugs": {
|
|
48
|
-
"url": "https://github.com/
|
|
48
|
+
"url": "https://github.com/applefanaimail-blip/llm/issues"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"bs58": "^6.0.0",
|