@dominusnode/openai-functions 1.0.0 → 1.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 CHANGED
@@ -1,6 +1,6 @@
1
- # DomiNode OpenAI-Compatible Function Calling Schemas
1
+ # Dominus Node OpenAI-Compatible Function Calling Schemas
2
2
 
3
- OpenAI function-calling schemas and handler implementations for the DomiNode rotating proxy-as-a-service platform. These schemas allow any LLM with function/tool calling support to interact with DomiNode's proxy network, wallet, and agentic wallet APIs.
3
+ OpenAI function-calling schemas and handler implementations for the Dominus Node rotating proxy-as-a-service platform. These schemas allow any LLM with function/tool calling support to interact with Dominus Node's proxy network, wallet, and agentic wallet APIs.
4
4
 
5
5
  ## What This Is
6
6
 
@@ -9,8 +9,8 @@ This directory contains:
9
9
  | File | Description |
10
10
  |------|-------------|
11
11
  | `functions.json` | Array of 8 OpenAI function definitions (JSON Schema format) |
12
- | `handler.ts` | TypeScript handler that dispatches function calls to the DomiNode API |
13
- | `handler.py` | Python handler that dispatches function calls to the DomiNode API |
12
+ | `handler.ts` | TypeScript handler that dispatches function calls to the Dominus Node API |
13
+ | `handler.py` | Python handler that dispatches function calls to the Dominus Node API |
14
14
 
15
15
  The function schemas follow the [OpenAI function calling specification](https://platform.openai.com/docs/guides/function-calling), which has become a de facto standard adopted by Claude (tool_use), Gemini, Mistral, Llama, and others.
16
16
 
@@ -18,7 +18,7 @@ The function schemas follow the [OpenAI function calling specification](https://
18
18
 
19
19
  | Function | Description | Auth Required |
20
20
  |----------|-------------|---------------|
21
- | `dominusnode_proxied_fetch` | Make an HTTP request through DomiNode's rotating proxy network | Yes |
21
+ | `dominusnode_proxied_fetch` | Make an HTTP request through Dominus Node's rotating proxy network | Yes |
22
22
  | `dominusnode_check_balance` | Check wallet balance (cents, USD, currency) | Yes |
23
23
  | `dominusnode_check_usage` | Check usage stats for a time period (day/week/month) | Yes |
24
24
  | `dominusnode_get_proxy_config` | Get proxy endpoints, supported countries, geo-targeting info | Yes |
@@ -38,7 +38,7 @@ from handler import create_dominusnode_function_handler
38
38
  with open("functions.json") as f:
39
39
  functions = json.load(f)
40
40
 
41
- # Create the DomiNode handler
41
+ # Create the Dominus Node handler
42
42
  dominusnode = create_dominusnode_function_handler(
43
43
  api_key="dn_live_your_api_key_here",
44
44
  base_url="https://api.dominusnode.com",
@@ -49,7 +49,7 @@ client = openai.OpenAI()
49
49
  response = client.chat.completions.create(
50
50
  model="gpt-4o",
51
51
  messages=[
52
- {"role": "system", "content": "You have access to DomiNode proxy tools."},
52
+ {"role": "system", "content": "You have access to Dominus Node proxy tools."},
53
53
  {"role": "user", "content": "What is my current proxy balance?"},
54
54
  ],
55
55
  functions=functions,
@@ -62,14 +62,14 @@ if message.function_call:
62
62
  name = message.function_call.name
63
63
  args = json.loads(message.function_call.arguments)
64
64
 
65
- # Dispatch to DomiNode handler
65
+ # Dispatch to Dominus Node handler
66
66
  result = await dominusnode(name, args)
67
67
 
68
68
  # Send the result back to the LLM
69
69
  response = client.chat.completions.create(
70
70
  model="gpt-4o",
71
71
  messages=[
72
- {"role": "system", "content": "You have access to DomiNode proxy tools."},
72
+ {"role": "system", "content": "You have access to Dominus Node proxy tools."},
73
73
  {"role": "user", "content": "What is my current proxy balance?"},
74
74
  message,
75
75
  {"role": "function", "name": name, "content": result},
@@ -100,7 +100,7 @@ tools = [
100
100
  for fn in functions
101
101
  ]
102
102
 
103
- # Create the DomiNode handler
103
+ # Create the Dominus Node handler
104
104
  dominusnode = create_dominusnode_function_handler(
105
105
  api_key="dn_live_your_api_key_here",
106
106
  )
@@ -112,7 +112,7 @@ response = client.messages.create(
112
112
  max_tokens=1024,
113
113
  tools=tools,
114
114
  messages=[
115
- {"role": "user", "content": "Check my DomiNode proxy balance and usage this week."},
115
+ {"role": "user", "content": "Check my Dominus Node proxy balance and usage this week."},
116
116
  ],
117
117
  )
118
118
 
@@ -127,7 +127,7 @@ for block in response.content:
127
127
  max_tokens=1024,
128
128
  tools=tools,
129
129
  messages=[
130
- {"role": "user", "content": "Check my DomiNode proxy balance and usage this week."},
130
+ {"role": "user", "content": "Check my Dominus Node proxy balance and usage this week."},
131
131
  {"role": "assistant", "content": response.content},
132
132
  {
133
133
  "role": "user",
@@ -204,7 +204,7 @@ The `functions.json` file follows the standard OpenAI function definition schema
204
204
  | **OpenAI SDK** | Pass `functions` directly to `chat.completions.create()` |
205
205
  | **Anthropic SDK** | Convert to `tools` format (rename `parameters` to `input_schema`) |
206
206
  | **Google Gemini** | Convert to `FunctionDeclaration` objects |
207
- | **LangChain** | Use `StructuredTool.from_function()` or the DomiNode LangChain integration |
207
+ | **LangChain** | Use `StructuredTool.from_function()` or the Dominus Node LangChain integration |
208
208
  | **Vercel AI SDK** | See the `integrations/vercel-ai/` package |
209
209
  | **LlamaIndex** | Use `FunctionTool.from_defaults()` with the handler |
210
210
  | **Ollama** | Pass as `tools` parameter in chat API |
package/dist/handler.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * DomiNode OpenAI-compatible function calling handler (TypeScript).
2
+ * Dominus Node OpenAI-compatible function calling handler (TypeScript).
3
3
  *
4
4
  * Provides a factory function that creates a handler for dispatching
5
- * OpenAI function calls to the DomiNode REST API. Works with any
5
+ * OpenAI function calls to the Dominus Node REST API. Works with any
6
6
  * function-calling LLM system: OpenAI GPT, Anthropic Claude tool_use,
7
7
  * Google Gemini, or custom implementations.
8
8
  *
@@ -40,23 +40,25 @@ declare function stripDangerousKeys(obj: unknown, depth?: number): void;
40
40
  declare function safeJsonParse<T>(text: string): T;
41
41
  declare function sanitizeError(message: string): string;
42
42
  export interface DominusNodeFunctionConfig {
43
- /** DomiNode API key (starts with dn_live_ or dn_test_). */
43
+ /** Dominus Node API key (starts with dn_live_ or dn_test_). */
44
44
  apiKey: string;
45
- /** Base URL of the DomiNode REST API. Defaults to https://api.dominusnode.com */
45
+ /** Base URL of the Dominus Node REST API. Defaults to https://api.dominusnode.com */
46
46
  baseUrl?: string;
47
47
  /** Request timeout in milliseconds. Defaults to 30000. */
48
48
  timeoutMs?: number;
49
+ /** Agent secret for MCP agent identification. Bypasses reCAPTCHA and auto-verifies email. */
50
+ agentSecret?: string;
49
51
  }
50
52
  /**
51
53
  * Handler function type returned by createDominusNodeFunctionHandler.
52
- * Dispatches function calls to the DomiNode API and returns JSON string results.
54
+ * Dispatches function calls to the Dominus Node API and returns JSON string results.
53
55
  */
54
56
  export type FunctionHandler = (name: string, args: Record<string, unknown>) => Promise<string>;
55
57
  /**
56
- * Create a DomiNode function handler for OpenAI-compatible function calling.
58
+ * Create a Dominus Node function handler for OpenAI-compatible function calling.
57
59
  *
58
60
  * Authenticates using the provided API key, then returns a handler function
59
- * that dispatches function calls to the appropriate DomiNode REST API endpoint.
61
+ * that dispatches function calls to the appropriate Dominus Node REST API endpoint.
60
62
  *
61
63
  * @param config - API key and optional base URL / timeout.
62
64
  * @returns A handler function: (name, args) => Promise<string>
package/dist/handler.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * DomiNode OpenAI-compatible function calling handler (TypeScript).
2
+ * Dominus Node OpenAI-compatible function calling handler (TypeScript).
3
3
  *
4
4
  * Provides a factory function that creates a handler for dispatching
5
- * OpenAI function calls to the DomiNode REST API. Works with any
5
+ * OpenAI function calls to the Dominus Node REST API. Works with any
6
6
  * function-calling LLM system: OpenAI GPT, Anthropic Claude tool_use,
7
7
  * Google Gemini, or custom implementations.
8
8
  *
@@ -312,6 +312,10 @@ async function apiRequest(config, method, path, body) {
312
312
  "Content-Type": "application/json",
313
313
  Authorization: `Bearer ${config.token}`,
314
314
  };
315
+ if (config.agentSecret) {
316
+ headers["X-DominusNode-Agent"] = "mcp";
317
+ headers["X-DominusNode-Agent-Secret"] = config.agentSecret;
318
+ }
315
319
  const response = await fetch(url, {
316
320
  method,
317
321
  headers,
@@ -364,10 +368,10 @@ function periodToDateRange(period) {
364
368
  return { since: since.toISOString(), until };
365
369
  }
366
370
  /**
367
- * Create a DomiNode function handler for OpenAI-compatible function calling.
371
+ * Create a Dominus Node function handler for OpenAI-compatible function calling.
368
372
  *
369
373
  * Authenticates using the provided API key, then returns a handler function
370
- * that dispatches function calls to the appropriate DomiNode REST API endpoint.
374
+ * that dispatches function calls to the appropriate Dominus Node REST API endpoint.
371
375
  *
372
376
  * @param config - API key and optional base URL / timeout.
373
377
  * @returns A handler function: (name, args) => Promise<string>
@@ -392,6 +396,7 @@ export { isPrivateIp, validateUrl, normalizeIpv4, sanitizeError, stripDangerousK
392
396
  export function createDominusNodeFunctionHandler(config) {
393
397
  const baseUrl = config.baseUrl ?? "https://api.dominusnode.com";
394
398
  const timeoutMs = config.timeoutMs ?? 30_000;
399
+ const agentSecret = config.agentSecret || process.env.DOMINUSNODE_AGENT_SECRET;
395
400
  if (!config.apiKey || typeof config.apiKey !== "string") {
396
401
  throw new Error("apiKey is required and must be a non-empty string");
397
402
  }
@@ -399,12 +404,17 @@ export function createDominusNodeFunctionHandler(config) {
399
404
  let authToken = null;
400
405
  let authPromise = null;
401
406
  async function authenticate() {
407
+ const authHeaders = {
408
+ "User-Agent": "dominusnode-openai-functions/1.0.0",
409
+ "Content-Type": "application/json",
410
+ };
411
+ if (agentSecret) {
412
+ authHeaders["X-DominusNode-Agent"] = "mcp";
413
+ authHeaders["X-DominusNode-Agent-Secret"] = agentSecret;
414
+ }
402
415
  const response = await fetch(`${baseUrl}/api/auth/verify-key`, {
403
416
  method: "POST",
404
- headers: {
405
- "User-Agent": "dominusnode-openai-functions/1.0.0",
406
- "Content-Type": "application/json",
407
- },
417
+ headers: authHeaders,
408
418
  body: JSON.stringify({ apiKey: config.apiKey }),
409
419
  signal: AbortSignal.timeout(timeoutMs),
410
420
  redirect: "error",
@@ -432,7 +442,7 @@ export function createDominusNodeFunctionHandler(config) {
432
442
  function api(method, path, body) {
433
443
  if (!authToken)
434
444
  throw new Error("Not authenticated");
435
- return apiRequest({ baseUrl, timeoutMs, token: authToken }, method, path, body);
445
+ return apiRequest({ baseUrl, timeoutMs, token: authToken, agentSecret }, method, path, body);
436
446
  }
437
447
  // -----------------------------------------------------------------------
438
448
  // Function handlers
@@ -487,7 +497,7 @@ export function createDominusNodeFunctionHandler(config) {
487
497
  }
488
498
  const username = userParts.join("-");
489
499
  // Use the proxy gateway for the actual request
490
- // The handler routes through the DomiNode proxy endpoint
500
+ // The handler routes through the Dominus Node proxy endpoint
491
501
  try {
492
502
  // Strip security-sensitive headers from user-provided headers
493
503
  const BLOCKED_HEADERS = new Set([
@@ -640,7 +650,7 @@ export function createDominusNodeFunctionHandler(config) {
640
650
  catch (err) {
641
651
  return JSON.stringify({
642
652
  error: `Proxy fetch failed: ${sanitizeError(err instanceof Error ? err.message : String(err))}`,
643
- hint: "Ensure the DomiNode proxy gateway is running and accessible.",
653
+ hint: "Ensure the Dominus Node proxy gateway is running and accessible.",
644
654
  });
645
655
  }
646
656
  }
@@ -923,6 +933,40 @@ export function createDominusNodeFunctionHandler(config) {
923
933
  const result = await api("POST", "/api/wallet/topup/paypal", { amountCents });
924
934
  return JSON.stringify(result);
925
935
  }
936
+ async function handleTopupStripe(args) {
937
+ const amountCents = args.amount_cents;
938
+ if (!Number.isInteger(amountCents) ||
939
+ amountCents < 500 ||
940
+ amountCents > 100_000) {
941
+ return JSON.stringify({
942
+ error: "amount_cents must be an integer between 500 ($5) and 100,000 ($1,000)",
943
+ });
944
+ }
945
+ const result = await api("POST", "/api/wallet/topup/stripe", { amountCents });
946
+ return JSON.stringify(result);
947
+ }
948
+ async function handleTopupCrypto(args) {
949
+ const amountUsd = args.amount_usd;
950
+ const currency = args.currency;
951
+ if (typeof amountUsd !== "number" || !Number.isFinite(amountUsd) || amountUsd < 5 || amountUsd > 1000) {
952
+ return JSON.stringify({
953
+ error: "amount_usd must be a number between 5 and 1,000",
954
+ });
955
+ }
956
+ const validCurrencies = new Set([
957
+ "BTC", "ETH", "LTC", "XMR", "ZEC", "USDC", "SOL", "USDT", "DAI", "BNB", "LINK",
958
+ ]);
959
+ if (!currency || typeof currency !== "string" || !validCurrencies.has(currency.toUpperCase())) {
960
+ return JSON.stringify({
961
+ error: "currency must be one of: BTC, ETH, LTC, XMR, ZEC, USDC, SOL, USDT, DAI, BNB, LINK",
962
+ });
963
+ }
964
+ const result = await api("POST", "/api/wallet/topup/crypto", {
965
+ amountUsd,
966
+ currency: currency.toLowerCase(),
967
+ });
968
+ return JSON.stringify(result);
969
+ }
926
970
  async function handleUpdateWalletPolicy(args) {
927
971
  const walletId = args.wallet_id;
928
972
  if (!walletId || typeof walletId !== "string") {
@@ -1033,6 +1077,8 @@ export function createDominusNodeFunctionHandler(config) {
1033
1077
  dominusnode_update_team: handleUpdateTeam,
1034
1078
  dominusnode_update_team_member_role: handleUpdateTeamMemberRole,
1035
1079
  dominusnode_topup_paypal: handleTopupPaypal,
1080
+ dominusnode_topup_stripe: handleTopupStripe,
1081
+ dominusnode_topup_crypto: handleTopupCrypto,
1036
1082
  dominusnode_x402_info: handleX402Info,
1037
1083
  };
1038
1084
  async function handleX402Info() {
package/functions.json CHANGED
@@ -1,7 +1,7 @@
1
1
  [
2
2
  {
3
3
  "name": "dominusnode_proxied_fetch",
4
- "description": "Make an HTTP request through DomiNode's rotating proxy network. Routes traffic through datacenter ($3/GB) or residential ($5/GB) proxies with optional geo-targeting. Useful for accessing geo-restricted content, avoiding IP blocks, or web scraping. Private/internal IPs and sanctioned countries (CU, IR, KP, RU, SY) are blocked.",
4
+ "description": "Make an HTTP request through Dominus Node's rotating proxy network. Routes traffic through datacenter ($3/GB) or residential ($5/GB) proxies with optional geo-targeting. Useful for accessing geo-restricted content, avoiding IP blocks, or web scraping. Private/internal IPs and sanctioned countries (CU, IR, KP, RU, SY) are blocked.",
5
5
  "parameters": {
6
6
  "type": "object",
7
7
  "properties": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  {
40
40
  "name": "dominusnode_check_balance",
41
- "description": "Check the current wallet balance for the authenticated DomiNode account. Returns balance in cents and USD, currency, and last top-up timestamp. The wallet uses a prepaid model -- top up first, then usage is debited automatically.",
41
+ "description": "Check the current wallet balance for the authenticated Dominus Node account. Returns balance in cents and USD, currency, and last top-up timestamp. The wallet uses a prepaid model -- top up first, then usage is debited automatically.",
42
42
  "parameters": {
43
43
  "type": "object",
44
44
  "properties": {},
@@ -47,7 +47,7 @@
47
47
  },
48
48
  {
49
49
  "name": "dominusnode_check_usage",
50
- "description": "Check proxy usage statistics for the authenticated DomiNode account. Returns total bytes transferred, total cost, and request count for the specified period. Useful for monitoring bandwidth consumption and spending.",
50
+ "description": "Check proxy usage statistics for the authenticated Dominus Node account. Returns total bytes transferred, total cost, and request count for the specified period. Useful for monitoring bandwidth consumption and spending.",
51
51
  "parameters": {
52
52
  "type": "object",
53
53
  "properties": {
@@ -63,7 +63,7 @@
63
63
  },
64
64
  {
65
65
  "name": "dominusnode_get_proxy_config",
66
- "description": "Get DomiNode proxy endpoint configuration and supported features. Returns HTTP and SOCKS5 proxy connection details, list of supported countries for geo-targeting, blocked/sanctioned countries, and geo-targeting capabilities. Use this to discover available proxy endpoints before making proxied requests.",
66
+ "description": "Get Dominus Node proxy endpoint configuration and supported features. Returns HTTP and SOCKS5 proxy connection details, list of supported countries for geo-targeting, blocked/sanctioned countries, and geo-targeting capabilities. Use this to discover available proxy endpoints before making proxied requests.",
67
67
  "parameters": {
68
68
  "type": "object",
69
69
  "properties": {},
@@ -72,7 +72,7 @@
72
72
  },
73
73
  {
74
74
  "name": "dominusnode_list_sessions",
75
- "description": "List all currently active proxy sessions for the authenticated DomiNode account. Returns session IDs, start times, and status. Useful for monitoring concurrent connections and debugging active proxy usage.",
75
+ "description": "List all currently active proxy sessions for the authenticated Dominus Node account. Returns session IDs, start times, and status. Useful for monitoring concurrent connections and debugging active proxy usage.",
76
76
  "parameters": {
77
77
  "type": "object",
78
78
  "properties": {},
@@ -402,7 +402,7 @@
402
402
  },
403
403
  {
404
404
  "name": "dominusnode_topup_paypal",
405
- "description": "Create a PayPal payment order to top up your DomiNode wallet. Returns an approval URL where you complete the payment. After approval, the wallet is credited automatically. Lower fees than Stripe for PayPal users. Minimum $5 (500 cents), maximum $1,000 (100,000 cents).",
405
+ "description": "Create a PayPal payment order to top up your Dominus Node wallet. Returns an approval URL where you complete the payment. After approval, the wallet is credited automatically. Lower fees than Stripe for PayPal users. Minimum $5 (500 cents), maximum $1,000 (100,000 cents).",
406
406
  "parameters": {
407
407
  "type": "object",
408
408
  "properties": {
@@ -415,5 +415,51 @@
415
415
  },
416
416
  "required": ["amount_cents"]
417
417
  }
418
+ },
419
+ {
420
+ "name": "dominusnode_topup_stripe",
421
+ "description": "Create a Stripe checkout session to top up your Dominus Node wallet with credit/debit card, Apple Pay, Google Pay, or Link. Returns a checkout URL. After payment, wallet is credited automatically. Minimum $5 (500 cents), maximum $1,000 (100,000 cents).",
422
+ "parameters": {
423
+ "type": "object",
424
+ "properties": {
425
+ "amount_cents": {
426
+ "type": "integer",
427
+ "description": "Amount in cents to add to wallet. Minimum 500 ($5.00), maximum 100000 ($1,000.00).",
428
+ "minimum": 500,
429
+ "maximum": 100000
430
+ }
431
+ },
432
+ "required": ["amount_cents"]
433
+ }
434
+ },
435
+ {
436
+ "name": "dominusnode_topup_crypto",
437
+ "description": "Create a cryptocurrency payment invoice to top up your Dominus Node wallet. Supports BTC, ETH, LTC, XMR, ZEC, USDC, SOL, USDT, DAI, BNB, and LINK. Returns a payment URL with address and amount. Privacy coins (XMR, ZEC) provide anonymous billing. Minimum $5, maximum $1,000.",
438
+ "parameters": {
439
+ "type": "object",
440
+ "properties": {
441
+ "amount_usd": {
442
+ "type": "number",
443
+ "description": "Amount in USD to add to wallet. Minimum 5, maximum 1000.",
444
+ "minimum": 5,
445
+ "maximum": 1000
446
+ },
447
+ "currency": {
448
+ "type": "string",
449
+ "description": "Cryptocurrency to pay with: BTC, ETH, LTC, XMR, ZEC, USDC, SOL, USDT, DAI, BNB, or LINK.",
450
+ "enum": ["BTC", "ETH", "LTC", "XMR", "ZEC", "USDC", "SOL", "USDT", "DAI", "BNB", "LINK"]
451
+ }
452
+ },
453
+ "required": ["amount_usd", "currency"]
454
+ }
455
+ },
456
+ {
457
+ "name": "dominusnode_x402_info",
458
+ "description": "Get x402 micropayment protocol information for pay-per-request proxy access. Returns the accepted payment networks (Coinbase Base USDC, PayAI Solana USDC, Polygon, Avalanche, Sei, and more), per-request pricing, and how to use the X-PAYMENT header for zero-signup proxy access. Use this when you want to pay per-request without a wallet top-up.",
459
+ "parameters": {
460
+ "type": "object",
461
+ "properties": {},
462
+ "required": []
463
+ }
418
464
  }
419
465
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dominusnode/openai-functions",
3
- "version": "1.0.0",
4
- "description": "DomiNode OpenAI-compatible function calling handler — dispatches LLM function calls to the DomiNode REST API",
3
+ "version": "1.1.0",
4
+ "description": "Dominus Node OpenAI-compatible function calling handler — dispatches LLM function calls to the Dominus Node REST API",
5
5
  "main": "dist/handler.js",
6
6
  "types": "dist/handler.d.ts",
7
7
  "type": "module",