@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.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _anthropic_ai_sdk from '@anthropic-ai/sdk';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Type definitions for
|
|
4
|
+
* Type definitions for BridgeNode LLM SDK
|
|
5
5
|
*/
|
|
6
6
|
interface FunctionDefinition {
|
|
7
7
|
name: string;
|
|
@@ -477,7 +477,7 @@ interface RpcError {
|
|
|
477
477
|
/**
|
|
478
478
|
* Response from a multi-chain JSON-RPC call.
|
|
479
479
|
*
|
|
480
|
-
* Standard JSON-RPC 2.0 envelope plus
|
|
480
|
+
* Standard JSON-RPC 2.0 envelope plus BridgeNode gateway metadata pulled
|
|
481
481
|
* from response headers (PAYMENT-RESPONSE / X-Network / X-Cache).
|
|
482
482
|
*/
|
|
483
483
|
interface RpcResponse<T = unknown> {
|
|
@@ -516,7 +516,7 @@ interface CallOptions {
|
|
|
516
516
|
to: string;
|
|
517
517
|
/** What the AI agent should do on the call. 10–4000 chars. */
|
|
518
518
|
task: string;
|
|
519
|
-
/** Your provisioned
|
|
519
|
+
/** Your provisioned BridgeNode caller-ID number (E.164). Must be wallet-owned. */
|
|
520
520
|
from?: string;
|
|
521
521
|
/** Voice preset or any Bland.ai voice ID. */
|
|
522
522
|
voice?: VoicePreset | string;
|
|
@@ -614,7 +614,7 @@ interface VideoGenerateOptions {
|
|
|
614
614
|
* Virtual Portrait asset ID (`ta_xxxxxx`) — keeps the same AI character
|
|
615
615
|
* across multiple Seedance videos. Enroll via `POST /v1/portrait/enroll`
|
|
616
616
|
* ($0.01 USDC promo, no KYC). **Seedance 2.0 fast/pro only.** Mutually exclusive
|
|
617
|
-
* with `imageUrl`. Real-person likeness is not supported on
|
|
617
|
+
* with `imageUrl`. Real-person likeness is not supported on BridgeNode.
|
|
618
618
|
*/
|
|
619
619
|
realFaceAssetId?: string;
|
|
620
620
|
/**
|
|
@@ -957,10 +957,10 @@ declare class APIError extends BridgeNodeError {
|
|
|
957
957
|
}
|
|
958
958
|
|
|
959
959
|
/**
|
|
960
|
-
*
|
|
960
|
+
* BridgeNode LLM Client - Main SDK entry point.
|
|
961
961
|
*
|
|
962
962
|
* Usage:
|
|
963
|
-
* import { LLMClient } from '@
|
|
963
|
+
* import { LLMClient } from '@bridgenode/llm';
|
|
964
964
|
*
|
|
965
965
|
* // Option 1: Use BASE_CHAIN_WALLET_KEY env var
|
|
966
966
|
* const client = new LLMClient();
|
|
@@ -973,7 +973,7 @@ declare class APIError extends BridgeNodeError {
|
|
|
973
973
|
*/
|
|
974
974
|
|
|
975
975
|
/**
|
|
976
|
-
*
|
|
976
|
+
* BridgeNode LLM Gateway Client.
|
|
977
977
|
*
|
|
978
978
|
* Provides access to multiple LLM providers (OpenAI, Anthropic, Google, etc.)
|
|
979
979
|
* with automatic x402 micropayments on Base chain (Mainnet, Chain ID 8453).
|
|
@@ -992,7 +992,7 @@ declare class LLMClient {
|
|
|
992
992
|
private preAuthCache;
|
|
993
993
|
private static readonly PRE_AUTH_TTL_MS;
|
|
994
994
|
/**
|
|
995
|
-
* Initialize the
|
|
995
|
+
* Initialize the BridgeNode LLM client.
|
|
996
996
|
*
|
|
997
997
|
* @param options - Client configuration options (optional if BASE_CHAIN_WALLET_KEY env var is set)
|
|
998
998
|
*/
|
|
@@ -1333,7 +1333,7 @@ declare class LLMClient {
|
|
|
1333
1333
|
/** Token price lookup ($0.001/call). Coins like "coingecko:bitcoin" or "{chain}:{address}". */
|
|
1334
1334
|
defiPrices(coins: string | string[]): Promise<Record<string, unknown>>;
|
|
1335
1335
|
/**
|
|
1336
|
-
* Query the 0x Swap / Gasless APIs (free — no x402 payment;
|
|
1336
|
+
* Query the 0x Swap / Gasless APIs (free — no x402 payment; BridgeNode
|
|
1337
1337
|
* takes an on-chain affiliate fee on executed swaps instead).
|
|
1338
1338
|
*
|
|
1339
1339
|
* @param path - "price", "quote", "gasless/price", "gasless/quote",
|
|
@@ -1392,16 +1392,16 @@ declare class LLMClient {
|
|
|
1392
1392
|
}
|
|
1393
1393
|
|
|
1394
1394
|
/**
|
|
1395
|
-
*
|
|
1395
|
+
* BridgeNode Image Client - Generate images via x402 micropayments.
|
|
1396
1396
|
*
|
|
1397
1397
|
* SECURITY NOTE - Private Key Handling:
|
|
1398
1398
|
* Your private key NEVER leaves your machine. Here's what happens:
|
|
1399
1399
|
* 1. Key stays local - only used to sign an EIP-712 typed data message
|
|
1400
1400
|
* 2. Only the SIGNATURE is sent in the PAYMENT-SIGNATURE header
|
|
1401
|
-
* 3.
|
|
1401
|
+
* 3. BridgeNode verifies the signature on-chain via Coinbase CDP facilitator
|
|
1402
1402
|
*
|
|
1403
1403
|
* Usage:
|
|
1404
|
-
* import { ImageClient } from '@
|
|
1404
|
+
* import { ImageClient } from '@bridgenode/llm';
|
|
1405
1405
|
*
|
|
1406
1406
|
* const client = new ImageClient({ privateKey: '0x...' });
|
|
1407
1407
|
* const result = await client.generate('A cute cat in space');
|
|
@@ -1409,7 +1409,7 @@ declare class LLMClient {
|
|
|
1409
1409
|
*/
|
|
1410
1410
|
|
|
1411
1411
|
/**
|
|
1412
|
-
*
|
|
1412
|
+
* BridgeNode Image Generation Client.
|
|
1413
1413
|
*
|
|
1414
1414
|
* Generate images using Nano Banana (Google Gemini), DALL-E 3, GPT Image,
|
|
1415
1415
|
* or CogView-4 (Zhipu AI) with automatic x402 micropayments on Base chain.
|
|
@@ -1422,7 +1422,7 @@ declare class ImageClient {
|
|
|
1422
1422
|
private sessionTotalUsd;
|
|
1423
1423
|
private sessionCalls;
|
|
1424
1424
|
/**
|
|
1425
|
-
* Initialize the
|
|
1425
|
+
* Initialize the BridgeNode Image client.
|
|
1426
1426
|
*
|
|
1427
1427
|
* @param options - Client configuration options
|
|
1428
1428
|
*/
|
|
@@ -1511,16 +1511,16 @@ declare class ImageClient {
|
|
|
1511
1511
|
}
|
|
1512
1512
|
|
|
1513
1513
|
/**
|
|
1514
|
-
*
|
|
1514
|
+
* BridgeNode Music Client - Generate music tracks via x402 micropayments.
|
|
1515
1515
|
*
|
|
1516
1516
|
* SECURITY NOTE - Private Key Handling:
|
|
1517
1517
|
* Your private key NEVER leaves your machine. Here's what happens:
|
|
1518
1518
|
* 1. Key stays local - only used to sign an EIP-712 typed data message
|
|
1519
1519
|
* 2. Only the SIGNATURE is sent in the PAYMENT-SIGNATURE header
|
|
1520
|
-
* 3.
|
|
1520
|
+
* 3. BridgeNode verifies the signature on-chain via Coinbase CDP facilitator
|
|
1521
1521
|
*
|
|
1522
1522
|
* Usage:
|
|
1523
|
-
* import { MusicClient } from '@
|
|
1523
|
+
* import { MusicClient } from '@bridgenode/llm';
|
|
1524
1524
|
*
|
|
1525
1525
|
* const client = new MusicClient({ privateKey: '0x...' });
|
|
1526
1526
|
* const result = await client.generate('upbeat synthwave with neon pads');
|
|
@@ -1528,7 +1528,7 @@ declare class ImageClient {
|
|
|
1528
1528
|
*/
|
|
1529
1529
|
|
|
1530
1530
|
/**
|
|
1531
|
-
*
|
|
1531
|
+
* BridgeNode Music Generation Client.
|
|
1532
1532
|
*
|
|
1533
1533
|
* Generate full-length ~3 minute music tracks using MiniMax Music 2.5+
|
|
1534
1534
|
* with automatic x402 micropayments on Base chain.
|
|
@@ -1572,21 +1572,21 @@ declare class MusicClient {
|
|
|
1572
1572
|
}
|
|
1573
1573
|
|
|
1574
1574
|
/**
|
|
1575
|
-
*
|
|
1575
|
+
* BridgeNode Speech Client - Text-to-speech and sound effects (ElevenLabs) via x402 micropayments.
|
|
1576
1576
|
*
|
|
1577
1577
|
* SECURITY NOTE - Private Key Handling:
|
|
1578
1578
|
* Your private key NEVER leaves your machine. Here's what happens:
|
|
1579
1579
|
* 1. Key stays local - only used to sign an EIP-712 typed data message
|
|
1580
1580
|
* 2. Only the SIGNATURE is sent in the PAYMENT-SIGNATURE header
|
|
1581
|
-
* 3.
|
|
1581
|
+
* 3. BridgeNode verifies the signature on-chain via Coinbase CDP facilitator
|
|
1582
1582
|
*
|
|
1583
1583
|
* Usage:
|
|
1584
|
-
* import { SpeechClient } from '@
|
|
1584
|
+
* import { SpeechClient } from '@bridgenode/llm';
|
|
1585
1585
|
*
|
|
1586
1586
|
* const client = new SpeechClient({ privateKey: '0x...' });
|
|
1587
1587
|
*
|
|
1588
1588
|
* // Text-to-speech (price scales with character count)
|
|
1589
|
-
* const result = await client.generate('Hello from
|
|
1589
|
+
* const result = await client.generate('Hello from BridgeNode!', { voice: 'sarah' });
|
|
1590
1590
|
* console.log(result.data[0].url);
|
|
1591
1591
|
*
|
|
1592
1592
|
* // Sound effects (flat $0.05/generation)
|
|
@@ -1606,7 +1606,7 @@ declare class MusicClient {
|
|
|
1606
1606
|
*/
|
|
1607
1607
|
|
|
1608
1608
|
/**
|
|
1609
|
-
*
|
|
1609
|
+
* BridgeNode Speech Client (BridgeNode Voice).
|
|
1610
1610
|
*
|
|
1611
1611
|
* Text-to-speech and sound-effect generation using ElevenLabs models
|
|
1612
1612
|
* with automatic x402 micropayments on Base chain.
|
|
@@ -1634,7 +1634,7 @@ declare class SpeechClient {
|
|
|
1634
1634
|
* @returns SpeechResponse with audio URL, format, and character count
|
|
1635
1635
|
*
|
|
1636
1636
|
* @example
|
|
1637
|
-
* const result = await client.generate('Welcome to
|
|
1637
|
+
* const result = await client.generate('Welcome to BridgeNode.', { voice: 'george' });
|
|
1638
1638
|
* console.log(result.data[0].url); // audio URL (mp3 by default)
|
|
1639
1639
|
*/
|
|
1640
1640
|
generate(input: string, options?: SpeechGenerateOptions): Promise<SpeechResponse>;
|
|
@@ -1670,13 +1670,13 @@ declare class SpeechClient {
|
|
|
1670
1670
|
}
|
|
1671
1671
|
|
|
1672
1672
|
/**
|
|
1673
|
-
*
|
|
1673
|
+
* BridgeNode Video Client - Generate short AI videos via x402 micropayments.
|
|
1674
1674
|
*
|
|
1675
1675
|
* SECURITY NOTE - Private Key Handling:
|
|
1676
1676
|
* Your private key NEVER leaves your machine. Here's what happens:
|
|
1677
1677
|
* 1. Key stays local - only used to sign an EIP-712 typed data message
|
|
1678
1678
|
* 2. Only the SIGNATURE is sent in the PAYMENT-SIGNATURE header
|
|
1679
|
-
* 3.
|
|
1679
|
+
* 3. BridgeNode verifies the signature on-chain via Coinbase CDP facilitator
|
|
1680
1680
|
*
|
|
1681
1681
|
* Async flow (client-polled):
|
|
1682
1682
|
* POST /v1/videos/generations -> 402 -> sign -> 202 { id, poll_url }
|
|
@@ -1688,7 +1688,7 @@ declare class SpeechClient {
|
|
|
1688
1688
|
* the caller giving up = zero charge.
|
|
1689
1689
|
*
|
|
1690
1690
|
* Usage:
|
|
1691
|
-
* import { VideoClient } from '@
|
|
1691
|
+
* import { VideoClient } from '@bridgenode/llm';
|
|
1692
1692
|
*
|
|
1693
1693
|
* const client = new VideoClient({ privateKey: '0x...' });
|
|
1694
1694
|
* const result = await client.generate('a red apple slowly spinning on a wooden table');
|
|
@@ -1697,7 +1697,7 @@ declare class SpeechClient {
|
|
|
1697
1697
|
*/
|
|
1698
1698
|
|
|
1699
1699
|
/**
|
|
1700
|
-
*
|
|
1700
|
+
* BridgeNode Video Generation Client.
|
|
1701
1701
|
*
|
|
1702
1702
|
* Supports xAI Grok Imagine Video and ByteDance Seedance (1.5 Pro /
|
|
1703
1703
|
* 2.0 Fast / 2.0 Pro) with automatic x402 micropayments on Base.
|
|
@@ -1775,20 +1775,20 @@ declare class VideoClient {
|
|
|
1775
1775
|
}
|
|
1776
1776
|
|
|
1777
1777
|
/**
|
|
1778
|
-
*
|
|
1778
|
+
* BridgeNode Voice Call Client - AI-powered outbound phone calls via x402 micropayments.
|
|
1779
1779
|
*
|
|
1780
1780
|
* The AI agent calls a phone number (E.164) and conducts a real-time conversation
|
|
1781
1781
|
* based on your 'task' instructions. STT, LLM, and TTS are handled upstream by
|
|
1782
|
-
* Bland.ai;
|
|
1782
|
+
* Bland.ai; BridgeNode handles billing through x402.
|
|
1783
1783
|
*
|
|
1784
1784
|
* SECURITY NOTE - Private Key Handling:
|
|
1785
1785
|
* Your private key NEVER leaves your machine. Here's what happens:
|
|
1786
1786
|
* 1. Key stays local - only used to sign an EIP-712 typed data message
|
|
1787
1787
|
* 2. Only the SIGNATURE is sent in the PAYMENT-SIGNATURE header
|
|
1788
|
-
* 3.
|
|
1788
|
+
* 3. BridgeNode verifies the signature on-chain via Coinbase CDP facilitator
|
|
1789
1789
|
*
|
|
1790
1790
|
* Usage:
|
|
1791
|
-
* import { VoiceClient } from '@
|
|
1791
|
+
* import { VoiceClient } from '@bridgenode/llm';
|
|
1792
1792
|
*
|
|
1793
1793
|
* const client = new VoiceClient({ privateKey: '0x...' });
|
|
1794
1794
|
*
|
|
@@ -1806,7 +1806,7 @@ declare class VideoClient {
|
|
|
1806
1806
|
*/
|
|
1807
1807
|
|
|
1808
1808
|
/**
|
|
1809
|
-
*
|
|
1809
|
+
* BridgeNode Voice Call Client.
|
|
1810
1810
|
*
|
|
1811
1811
|
* Initiates AI-powered outbound phone calls with automatic x402 micropayments
|
|
1812
1812
|
* on Base chain.
|
|
@@ -1852,7 +1852,7 @@ declare class VoiceClient {
|
|
|
1852
1852
|
}
|
|
1853
1853
|
|
|
1854
1854
|
/**
|
|
1855
|
-
*
|
|
1855
|
+
* BridgeNode Phone Client — Twilio-backed phone lookup + number provisioning via x402.
|
|
1856
1856
|
*
|
|
1857
1857
|
* Endpoints (all under /v1/phone/...):
|
|
1858
1858
|
* POST /lookup $0.01 Carrier + line-type lookup
|
|
@@ -1869,7 +1869,7 @@ declare class VoiceClient {
|
|
|
1869
1869
|
* signatures are sent in the PAYMENT-SIGNATURE header.
|
|
1870
1870
|
*
|
|
1871
1871
|
* @example
|
|
1872
|
-
* import { PhoneClient } from '@
|
|
1872
|
+
* import { PhoneClient } from '@bridgenode/llm';
|
|
1873
1873
|
*
|
|
1874
1874
|
* const client = new PhoneClient({ privateKey: '0x...' });
|
|
1875
1875
|
*
|
|
@@ -1891,7 +1891,7 @@ declare class VoiceClient {
|
|
|
1891
1891
|
/** Per-endpoint price in USD — mirrors the backend's `PHONE_PRICES`. */
|
|
1892
1892
|
declare const PHONE_PRICES: Readonly<Record<string, number>>;
|
|
1893
1893
|
/**
|
|
1894
|
-
*
|
|
1894
|
+
* BridgeNode Phone Client.
|
|
1895
1895
|
*
|
|
1896
1896
|
* Wraps the `/v1/phone/*` x402 endpoints — phone-number lookup (carrier + fraud)
|
|
1897
1897
|
* and provisioning of the caller-ID numbers required by VoiceClient.call().
|
|
@@ -1952,7 +1952,7 @@ declare class PhoneClient {
|
|
|
1952
1952
|
}
|
|
1953
1953
|
|
|
1954
1954
|
/**
|
|
1955
|
-
*
|
|
1955
|
+
* BridgeNode Portrait Client — enroll a Virtual Portrait via x402.
|
|
1956
1956
|
*
|
|
1957
1957
|
* Wraps `POST /v1/portrait/enroll` ($0.01 USDC promo, no KYC). You upload a face image
|
|
1958
1958
|
* by URL and get back a Token360 asset id (`ta_xxxxxx`). Pass that id as
|
|
@@ -1963,7 +1963,7 @@ declare class PhoneClient {
|
|
|
1963
1963
|
* signatures are sent in the PAYMENT-SIGNATURE header.
|
|
1964
1964
|
*
|
|
1965
1965
|
* @example
|
|
1966
|
-
* import { PortraitClient, VideoClient } from '@
|
|
1966
|
+
* import { PortraitClient, VideoClient } from '@bridgenode/llm';
|
|
1967
1967
|
*
|
|
1968
1968
|
* const portraits = new PortraitClient({ privateKey: '0x...' });
|
|
1969
1969
|
* const { asset_id } = await portraits.enroll({
|
|
@@ -1985,11 +1985,11 @@ declare class PhoneClient {
|
|
|
1985
1985
|
*/
|
|
1986
1986
|
declare const PORTRAIT_ENROLLMENT_PRICE_USD = 0.01;
|
|
1987
1987
|
/**
|
|
1988
|
-
*
|
|
1988
|
+
* BridgeNode Portrait Client.
|
|
1989
1989
|
*
|
|
1990
1990
|
* Enrolls a Virtual Portrait from a face image URL and returns the `ta_xxxxxx`
|
|
1991
1991
|
* asset id consumed by Seedance 2.0 video generation. Real-person likeness is
|
|
1992
|
-
* not supported on
|
|
1992
|
+
* not supported on BridgeNode — enrolled portraits are AI characters.
|
|
1993
1993
|
*/
|
|
1994
1994
|
declare class PortraitClient {
|
|
1995
1995
|
private account;
|
|
@@ -2021,7 +2021,7 @@ declare class PortraitClient {
|
|
|
2021
2021
|
}
|
|
2022
2022
|
|
|
2023
2023
|
/**
|
|
2024
|
-
*
|
|
2024
|
+
* BridgeNode Search Client - Standalone Grok Live Search via x402 micropayments.
|
|
2025
2025
|
*
|
|
2026
2026
|
* Backend endpoint: POST /api/v1/search
|
|
2027
2027
|
* Pricing: $0.025/source + margin (default 10 sources ≈ $0.26).
|
|
@@ -2050,7 +2050,7 @@ declare class SearchClient {
|
|
|
2050
2050
|
}
|
|
2051
2051
|
|
|
2052
2052
|
/**
|
|
2053
|
-
*
|
|
2053
|
+
* BridgeNode Price Client - Pyth-backed market data via x402.
|
|
2054
2054
|
*
|
|
2055
2055
|
* Payment gating mirrors CategoryConfig.paid in the backend:
|
|
2056
2056
|
* crypto, fx, commodity → FREE across price + history + list
|
|
@@ -2083,7 +2083,7 @@ declare class PriceClient {
|
|
|
2083
2083
|
}
|
|
2084
2084
|
|
|
2085
2085
|
/**
|
|
2086
|
-
*
|
|
2086
|
+
* BridgeNode Surf Client — pay-per-call crypto data via x402 micropayments.
|
|
2087
2087
|
*
|
|
2088
2088
|
* Surf aggregates 84+ endpoints across CEX/DEX market data, on-chain SQL,
|
|
2089
2089
|
* wallet intelligence, prediction markets, social analytics, and news under
|
|
@@ -2151,7 +2151,7 @@ declare class SurfClient {
|
|
|
2151
2151
|
}
|
|
2152
2152
|
|
|
2153
2153
|
/**
|
|
2154
|
-
*
|
|
2154
|
+
* BridgeNode RPC Client - Multi-chain JSON-RPC (Tatum gateway) via x402 micropayments.
|
|
2155
2155
|
*
|
|
2156
2156
|
* One endpoint, 40+ chains: Ethereum, Base, Solana, Polygon, BSC, Arbitrum,
|
|
2157
2157
|
* Optimism, Avalanche, Bitcoin, Sui, and more. Standard JSON-RPC 2.0
|
|
@@ -2161,10 +2161,10 @@ declare class SurfClient {
|
|
|
2161
2161
|
* Your private key NEVER leaves your machine. Here's what happens:
|
|
2162
2162
|
* 1. Key stays local - only used to sign an EIP-712 typed data message
|
|
2163
2163
|
* 2. Only the SIGNATURE is sent in the PAYMENT-SIGNATURE header
|
|
2164
|
-
* 3.
|
|
2164
|
+
* 3. BridgeNode verifies the signature on-chain via Coinbase CDP facilitator
|
|
2165
2165
|
*
|
|
2166
2166
|
* Usage:
|
|
2167
|
-
* import { RpcClient } from '@
|
|
2167
|
+
* import { RpcClient } from '@bridgenode/llm';
|
|
2168
2168
|
*
|
|
2169
2169
|
* const client = new RpcClient({ privateKey: '0x...' });
|
|
2170
2170
|
*
|
|
@@ -2212,9 +2212,9 @@ type RpcNetwork = (typeof SUPPORTED_NETWORKS)[number] | (string & {});
|
|
|
2212
2212
|
/** Common short names the gateway also accepts (resolved server-side). */
|
|
2213
2213
|
declare const NETWORK_ALIASES: Record<string, string>;
|
|
2214
2214
|
/**
|
|
2215
|
-
*
|
|
2215
|
+
* BridgeNode Multi-chain RPC Client.
|
|
2216
2216
|
*
|
|
2217
|
-
* Standard JSON-RPC 2.0 access to 40+ chains through
|
|
2217
|
+
* Standard JSON-RPC 2.0 access to 40+ chains through BridgeNode's Tatum
|
|
2218
2218
|
* gateway with automatic x402 micropayments on Base chain.
|
|
2219
2219
|
*
|
|
2220
2220
|
* Flat $0.002 per call; a JSON-RPC batch charges per element.
|
|
@@ -2270,15 +2270,15 @@ declare class RpcClient {
|
|
|
2270
2270
|
}
|
|
2271
2271
|
|
|
2272
2272
|
/**
|
|
2273
|
-
*
|
|
2273
|
+
* BridgeNodeClient — the x402-paying HTTP primitive for the BridgeNode gateway.
|
|
2274
2274
|
*
|
|
2275
|
-
* This is the **primitive** that every
|
|
2275
|
+
* This is the **primitive** that every BridgeNode API surface composes on top of:
|
|
2276
2276
|
* a wallet, an x402 401-sign-replay handler, and four call shapes (get, post,
|
|
2277
2277
|
* poll, stream). Per-API classes (LLMClient, ImageClient, SurfClient, …) are
|
|
2278
2278
|
* being collapsed into Claude Code skills that drive this client directly.
|
|
2279
2279
|
*
|
|
2280
2280
|
* Why one primitive instead of one client per API surface:
|
|
2281
|
-
* - Every
|
|
2281
|
+
* - Every BridgeNode endpoint pays the same way (USDC via x402 on Base/Solana)
|
|
2282
2282
|
* - ~30-40 % of each existing client class is identical boilerplate
|
|
2283
2283
|
* - New API surfaces should ship as a skill (markdown) + path, not as a
|
|
2284
2284
|
* new TypeScript class + npm release
|
|
@@ -2290,9 +2290,9 @@ declare class RpcClient {
|
|
|
2290
2290
|
* client.stream<T>(path, body?) — SSE iterator, e.g. /v1/chat/completions
|
|
2291
2291
|
*
|
|
2292
2292
|
* Usage:
|
|
2293
|
-
* import {
|
|
2293
|
+
* import { BridgeNodeClient } from "@bridgenode/llm";
|
|
2294
2294
|
*
|
|
2295
|
-
* const br = new
|
|
2295
|
+
* const br = new BridgeNodeClient({ privateKey: "0x..." });
|
|
2296
2296
|
*
|
|
2297
2297
|
* // Surf endpoint (Tier 1, $0.001)
|
|
2298
2298
|
* const btc = await br.get("/v1/surf/market/price", { symbol: "BTC" });
|
|
@@ -2326,7 +2326,7 @@ type QueryParams = Record<string, QueryValue | QueryValue[]>;
|
|
|
2326
2326
|
* One instance, one wallet, all endpoints. The four call shapes (get, post,
|
|
2327
2327
|
* poll, stream) cover every endpoint type the gateway exposes.
|
|
2328
2328
|
*/
|
|
2329
|
-
declare class
|
|
2329
|
+
declare class BridgeNodeClient {
|
|
2330
2330
|
private account;
|
|
2331
2331
|
private privateKey;
|
|
2332
2332
|
private apiUrl;
|
|
@@ -2335,13 +2335,13 @@ declare class BlockrunClient {
|
|
|
2335
2335
|
private sessionCalls;
|
|
2336
2336
|
constructor(options?: BridgeNodeClientOptions);
|
|
2337
2337
|
/**
|
|
2338
|
-
* GET a
|
|
2338
|
+
* GET a BridgeNode endpoint. `path` is everything after `/api` (a leading
|
|
2339
2339
|
* `/api` is tolerated and stripped). Query params are URL-encoded; arrays
|
|
2340
2340
|
* become repeated keys (`?a=1&a=2`); undefined/null are dropped.
|
|
2341
2341
|
*/
|
|
2342
2342
|
get<T = unknown>(path: string, params?: QueryParams): Promise<T>;
|
|
2343
2343
|
/**
|
|
2344
|
-
* POST a
|
|
2344
|
+
* POST a BridgeNode endpoint with a JSON body.
|
|
2345
2345
|
*/
|
|
2346
2346
|
post<T = unknown>(path: string, body?: Record<string, unknown>): Promise<T>;
|
|
2347
2347
|
/**
|
|
@@ -2394,7 +2394,7 @@ declare class BlockrunClient {
|
|
|
2394
2394
|
}
|
|
2395
2395
|
|
|
2396
2396
|
/**
|
|
2397
|
-
* x402 Payment Protocol v2 Implementation for
|
|
2397
|
+
* x402 Payment Protocol v2 Implementation for BridgeNode.
|
|
2398
2398
|
*
|
|
2399
2399
|
* This module handles creating signed payment payloads for the x402 v2 protocol.
|
|
2400
2400
|
* The private key is used ONLY for local signing and NEVER leaves the client.
|
|
@@ -2491,7 +2491,7 @@ declare function extractPaymentDetails(paymentRequired: PaymentRequired, preferr
|
|
|
2491
2491
|
};
|
|
2492
2492
|
|
|
2493
2493
|
/**
|
|
2494
|
-
*
|
|
2494
|
+
* BridgeNode Wallet Management - Auto-create and manage wallets.
|
|
2495
2495
|
*
|
|
2496
2496
|
* Provides frictionless wallet setup for new users:
|
|
2497
2497
|
* - Auto-creates wallet if none exists
|
|
@@ -2532,7 +2532,7 @@ declare function saveWallet(privateKey: string): string;
|
|
|
2532
2532
|
* Each file should contain JSON with "privateKey" and "address" fields.
|
|
2533
2533
|
* Results are sorted by modification time (most recent first). Discovery is
|
|
2534
2534
|
* intentionally opt-in: a provider wallet must never replace the canonical
|
|
2535
|
-
*
|
|
2535
|
+
* BridgeNode wallet merely because it was written more recently.
|
|
2536
2536
|
*
|
|
2537
2537
|
* @returns Array of wallet objects with privateKey and address
|
|
2538
2538
|
*/
|
|
@@ -2557,7 +2557,7 @@ declare function listDiscoveredWallets(): Array<{
|
|
|
2557
2557
|
source: string;
|
|
2558
2558
|
}>;
|
|
2559
2559
|
/**
|
|
2560
|
-
* Adopt a discovered wallet by address, making it the active
|
|
2560
|
+
* Adopt a discovered wallet by address, making it the active BridgeNode wallet.
|
|
2561
2561
|
*
|
|
2562
2562
|
* This is the deliberate migration path: automatic selection never adopts a
|
|
2563
2563
|
* discovered wallet, but you can choose one whose funds you want to spend.
|
|
@@ -2657,10 +2657,10 @@ declare const WALLET_FILE_PATH: string;
|
|
|
2657
2657
|
declare const WALLET_DIR_PATH: string;
|
|
2658
2658
|
|
|
2659
2659
|
/**
|
|
2660
|
-
*
|
|
2660
|
+
* BridgeNode Solana LLM Client.
|
|
2661
2661
|
*
|
|
2662
2662
|
* Usage:
|
|
2663
|
-
* import { SolanaLLMClient } from '@
|
|
2663
|
+
* import { SolanaLLMClient } from '@bridgenode/llm';
|
|
2664
2664
|
*
|
|
2665
2665
|
* // SOLANA_WALLET_KEY env var (bs58-encoded Solana secret key)
|
|
2666
2666
|
* const client = new SolanaLLMClient();
|
|
@@ -2677,7 +2677,7 @@ interface SolanaLLMClientOptions {
|
|
|
2677
2677
|
/** API endpoint URL (default: https://sol.bridgenode.cc/api) */
|
|
2678
2678
|
apiUrl?: string;
|
|
2679
2679
|
/**
|
|
2680
|
-
* Solana JSON-RPC URL. Defaults to
|
|
2680
|
+
* Solana JSON-RPC URL. Defaults to BridgeNode's own Tatum-backed proxy
|
|
2681
2681
|
* (`https://sol.bridgenode.cc/api/v1/solana/rpc`), free for SDK users.
|
|
2682
2682
|
* Override to point at your own Helius / Tatum / QuickNode account, or
|
|
2683
2683
|
* fall back to the env vars `SOLANA_RPC_URL` /
|
|
@@ -2784,7 +2784,7 @@ declare class SolanaLLMClient {
|
|
|
2784
2784
|
/** Token price lookup ($0.001/call). Coins like "coingecko:bitcoin" or "{chain}:{address}". */
|
|
2785
2785
|
defiPrices(coins: string | string[]): Promise<Record<string, unknown>>;
|
|
2786
2786
|
/**
|
|
2787
|
-
* Query the 0x Swap / Gasless APIs (free — no x402 payment;
|
|
2787
|
+
* Query the 0x Swap / Gasless APIs (free — no x402 payment; BridgeNode
|
|
2788
2788
|
* takes an on-chain affiliate fee on executed swaps instead).
|
|
2789
2789
|
*
|
|
2790
2790
|
* @param path - "price", "quote", "gasless/price", "gasless/quote",
|
|
@@ -2875,7 +2875,7 @@ declare function saveSolanaWallet(privateKey: string): string;
|
|
|
2875
2875
|
* Each file should contain JSON with "privateKey" and "address" fields.
|
|
2876
2876
|
* Also checks ~/.brcc/wallet.json for BRCC wallets.
|
|
2877
2877
|
* Results are sorted by modification time (most recent first). Discovery is
|
|
2878
|
-
* opt-in and never changes the active
|
|
2878
|
+
* opt-in and never changes the active BridgeNode wallet automatically.
|
|
2879
2879
|
*
|
|
2880
2880
|
* @returns Array of wallet objects with secretKey and publicKey
|
|
2881
2881
|
*/
|
|
@@ -2899,7 +2899,7 @@ declare function listDiscoveredSolanaWallets(): Promise<Array<{
|
|
|
2899
2899
|
source: string;
|
|
2900
2900
|
}>>;
|
|
2901
2901
|
/**
|
|
2902
|
-
* Adopt a discovered Solana wallet, making it the active
|
|
2902
|
+
* Adopt a discovered Solana wallet, making it the active BridgeNode wallet.
|
|
2903
2903
|
*
|
|
2904
2904
|
* Solana counterpart of `importWallet()`. Matching is done against the address
|
|
2905
2905
|
* derived from each discovered key, and the current
|
|
@@ -2978,7 +2978,7 @@ declare function getCostSummary(): {
|
|
|
2978
2978
|
};
|
|
2979
2979
|
|
|
2980
2980
|
/**
|
|
2981
|
-
* OpenAI-compatible API wrapper for
|
|
2981
|
+
* OpenAI-compatible API wrapper for BridgeNode LLM SDK.
|
|
2982
2982
|
*
|
|
2983
2983
|
* Drop-in replacement for OpenAI SDK - just change the import and use walletKey instead of apiKey.
|
|
2984
2984
|
*
|
|
@@ -2987,8 +2987,8 @@ declare function getCostSummary(): {
|
|
|
2987
2987
|
* import OpenAI from 'openai';
|
|
2988
2988
|
* const client = new OpenAI({ apiKey: 'sk-...' });
|
|
2989
2989
|
*
|
|
2990
|
-
* // After (
|
|
2991
|
-
* import { OpenAI } from '@
|
|
2990
|
+
* // After (BridgeNode)
|
|
2991
|
+
* import { OpenAI } from '@bridgenode/llm';
|
|
2992
2992
|
* const client = new OpenAI({ walletKey: '0x...' });
|
|
2993
2993
|
*
|
|
2994
2994
|
* // Rest of your code stays exactly the same!
|
|
@@ -3091,12 +3091,12 @@ declare class Chat {
|
|
|
3091
3091
|
constructor(client: LLMClient, apiUrl: string, timeout: number);
|
|
3092
3092
|
}
|
|
3093
3093
|
/**
|
|
3094
|
-
* OpenAI-compatible client for
|
|
3094
|
+
* OpenAI-compatible client for BridgeNode.
|
|
3095
3095
|
*
|
|
3096
3096
|
* Drop-in replacement for the OpenAI SDK.
|
|
3097
3097
|
*
|
|
3098
3098
|
* @example
|
|
3099
|
-
* import { OpenAI } from '@
|
|
3099
|
+
* import { OpenAI } from '@bridgenode/llm';
|
|
3100
3100
|
*
|
|
3101
3101
|
* const client = new OpenAI({ walletKey: '0x...' });
|
|
3102
3102
|
*
|
|
@@ -3137,7 +3137,7 @@ declare class AnthropicClient {
|
|
|
3137
3137
|
}
|
|
3138
3138
|
|
|
3139
3139
|
/**
|
|
3140
|
-
* Input validation and security utilities for
|
|
3140
|
+
* Input validation and security utilities for BridgeNode LLM SDK.
|
|
3141
3141
|
*
|
|
3142
3142
|
* This module provides validation functions to ensure:
|
|
3143
3143
|
* - Private keys are properly formatted
|
|
@@ -3207,4 +3207,4 @@ declare function validateTemperature(temperature?: number): void;
|
|
|
3207
3207
|
*/
|
|
3208
3208
|
declare function validateTopP(topP?: number): void;
|
|
3209
3209
|
|
|
3210
|
-
export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, type BridgeNodeAnthropicOptions,
|
|
3210
|
+
export { APIError, AnthropicClient, type AudioModel, type AudioTrack, BASE_CHAIN_ID, type BarResolution, type BridgeNodeAnthropicOptions, BridgeNodeClient, type BridgeNodeClientOptions, BridgeNodeError, type CallInitiatedResponse, type CallModel, type CallOptions, type CallStatusResponse, type ChatChoice, type ChatCompletionOptions, type ChatMessage, type ChatOptions, type ChatResponse, type ChatResponseWithCost, type ChatUsage, type CostEntry, type CostEstimate, type CreatePaymentOptions, type FunctionCall, type FunctionDefinition, type HistoryOptions, ImageClient, type ImageClientOptions, type ImageData, type ImageEditOptions, type ImageGenerateOptions, type ImageModel, type ImageResponse, KNOWN_PROVIDERS, LLMClient, type LLMClientOptions, type ListOptions, type MarketSession, type Model, MusicClient, type MusicClientOptions, type MusicGenerateOptions, type MusicResponse, NETWORK_ALIASES, type NewsSearchSource, OpenAI, type OpenAIChatCompletionChoice, type OpenAIChatCompletionChunk, type OpenAIChatCompletionParams, type OpenAIChatCompletionResponse, type OpenAIClientOptions, PHONE_PRICES, PORTRAIT_ENROLLMENT_PRICE_USD, PaymentError, type PaymentLinks, type PhoneBuyOptions, type PhoneBuyResponse, PhoneClient, type PhoneClientOptions, type PhoneListResponse, type PhoneLookupResponse, type PhoneNumberRecord, type PhoneReleaseResponse, type PhoneRenewResponse, type PollOptions, PortraitClient, type PortraitClientOptions, type PortraitEnrollOptions, type PortraitEnrollResponse, type PriceBar, type PriceCategory, PriceClient, type PriceClientOptions, type PriceHistoryResponse, type PriceOptions, type PricePoint, RPC_PRICE_USD, type ResponseFormat, type RoutingDecision, type RoutingProfile, type RoutingTier, type RpcBatchRequest, RpcClient, type RpcClientOptions, type RpcError, type RpcNetwork, type RpcResponse, type RssSearchSource, SOLANA_NETWORK, SOLANA_WALLET_FILE as SOLANA_WALLET_FILE_PATH, SUPPORTED_NETWORKS, SearchClient, type SearchClientOptions, type SearchOptions, type SearchParameters, type SearchResult, type SearchSource, type SearchUsage, type SmartChatOptions, type SmartChatResponse, SolanaLLMClient, type SolanaLLMClientOptions, type SolanaWalletInfo, type SoundEffectOptions, type SpeechAudio, SpeechClient, type SpeechClientOptions, type SpeechGenerateOptions, type SpeechModel, type SpeechResponse, type SpeechVoice, type Spending, type SpendingReport, type StockMarket, SurfClient, type SurfClientOptions, type SymbolListResponse, type Tool, type ToolCall, type ToolChoice, USDC_BASE, USDC_BASE_CONTRACT, USDC_SOLANA, VideoClient, type VideoClientOptions, type VideoClip, type VideoGenerateOptions, type VideoModel, type VideoResponse, VoiceClient, type VoiceClientOptions, type VoiceInfo, type VoicePreset, WALLET_DIR_PATH, WALLET_FILE_PATH, type WalletInfo, type WebSearchSource, type XSearchSource, clearCache, createPaymentPayload, createSolanaPaymentPayload, createSolanaWallet, createWallet, LLMClient as default, extractPaymentDetails, formatFundingMessageCompact, formatNeedsFundingMessage, formatSolanaWalletMigrationNotice, formatWalletCreatedMessage, formatWalletMigrationNotice, getCached, getCachedByRequest, getCostLogSummary, getCostSummary, getEip681Uri, getOrCreateSolanaWallet, getOrCreateWallet, getPaymentLinks, getWalletAddress, importSolanaWallet, importWallet, listDiscoveredSolanaWallets, listDiscoveredWallets, loadSolanaWallet, loadWallet, logCost, parsePaymentRequired, saveSolanaWallet, saveToCache, saveWallet, scanSolanaWallets, scanWallets, setCache, setupAgentSolanaWallet, setupAgentWallet, solanaClient, solanaKeyToBytes, solanaPublicKey, status, validateMaxTokens, validateModel, validateTemperature, validateTopP };
|