@dominusnode/openai-functions 1.1.0 → 1.3.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 +32 -29
- package/dist/handler.d.ts +3 -0
- package/dist/handler.js +916 -62
- package/functions.json +13 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -6,26 +6,26 @@ OpenAI function-calling schemas and handler implementations for the Dominus Node
|
|
|
6
6
|
|
|
7
7
|
This directory contains:
|
|
8
8
|
|
|
9
|
-
| File
|
|
10
|
-
|
|
11
|
-
| `functions.json` | Array of 8 OpenAI function definitions (JSON Schema format)
|
|
12
|
-
| `handler.ts`
|
|
13
|
-
| `handler.py`
|
|
9
|
+
| File | Description |
|
|
10
|
+
| ---------------- | ------------------------------------------------------------------------- |
|
|
11
|
+
| `functions.json` | Array of 8 OpenAI function definitions (JSON Schema format) |
|
|
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
|
|
|
17
17
|
## Available Functions
|
|
18
18
|
|
|
19
|
-
| Function
|
|
20
|
-
|
|
21
|
-
| `dominusnode_proxied_fetch`
|
|
22
|
-
| `dominusnode_check_balance`
|
|
23
|
-
| `dominusnode_check_usage`
|
|
24
|
-
| `dominusnode_get_proxy_config`
|
|
25
|
-
| `dominusnode_list_sessions`
|
|
26
|
-
| `dominusnode_create_agentic_wallet`
|
|
27
|
-
| `dominusnode_fund_agentic_wallet`
|
|
28
|
-
| `dominusnode_agentic_wallet_balance` | Check an agentic wallet's balance and status
|
|
19
|
+
| Function | Description | Auth Required |
|
|
20
|
+
| ------------------------------------ | ------------------------------------------------------------------ | ------------- |
|
|
21
|
+
| `dominusnode_proxied_fetch` | Make an HTTP request through Dominus Node's rotating proxy network | Yes |
|
|
22
|
+
| `dominusnode_check_balance` | Check wallet balance (cents, USD, currency) | Yes |
|
|
23
|
+
| `dominusnode_check_usage` | Check usage stats for a time period (day/week/month) | Yes |
|
|
24
|
+
| `dominusnode_get_proxy_config` | Get proxy endpoints, supported countries, geo-targeting info | Yes |
|
|
25
|
+
| `dominusnode_list_sessions` | List currently active proxy sessions | Yes |
|
|
26
|
+
| `dominusnode_create_agentic_wallet` | Create a sub-wallet for an AI agent with spending limits | Yes |
|
|
27
|
+
| `dominusnode_fund_agentic_wallet` | Transfer funds from main wallet to an agentic wallet | Yes |
|
|
28
|
+
| `dominusnode_agentic_wallet_balance` | Check an agentic wallet's balance and status | Yes |
|
|
29
29
|
|
|
30
30
|
## Usage with OpenAI GPT (Function Calling)
|
|
31
31
|
|
|
@@ -176,13 +176,13 @@ console.log(JSON.parse(fetchResult));
|
|
|
176
176
|
// Example: create and fund an agentic wallet for an AI agent
|
|
177
177
|
const wallet = await handler("dominusnode_create_agentic_wallet", {
|
|
178
178
|
label: "research-agent-1",
|
|
179
|
-
spending_limit_cents: 500,
|
|
179
|
+
spending_limit_cents: 500, // $5.00 per-transaction limit
|
|
180
180
|
});
|
|
181
181
|
const walletData = JSON.parse(wallet);
|
|
182
182
|
|
|
183
183
|
await handler("dominusnode_fund_agentic_wallet", {
|
|
184
184
|
wallet_id: walletData.id,
|
|
185
|
-
amount_cents: 2000,
|
|
185
|
+
amount_cents: 2000, // Fund with $20.00
|
|
186
186
|
});
|
|
187
187
|
```
|
|
188
188
|
|
|
@@ -199,15 +199,15 @@ The `functions.json` file follows the standard OpenAI function definition schema
|
|
|
199
199
|
|
|
200
200
|
### Framework-Specific Notes
|
|
201
201
|
|
|
202
|
-
| Framework
|
|
203
|
-
|
|
204
|
-
| **OpenAI SDK**
|
|
205
|
-
| **Anthropic SDK** | Convert to `tools` format (rename `parameters` to `input_schema`)
|
|
206
|
-
| **Google Gemini** | Convert to `FunctionDeclaration` objects
|
|
207
|
-
| **LangChain**
|
|
208
|
-
| **Vercel AI SDK** | See the `integrations/vercel-ai/` package
|
|
209
|
-
| **LlamaIndex**
|
|
210
|
-
| **Ollama**
|
|
202
|
+
| Framework | How to Use |
|
|
203
|
+
| ----------------- | ------------------------------------------------------------------------------ |
|
|
204
|
+
| **OpenAI SDK** | Pass `functions` directly to `chat.completions.create()` |
|
|
205
|
+
| **Anthropic SDK** | Convert to `tools` format (rename `parameters` to `input_schema`) |
|
|
206
|
+
| **Google Gemini** | Convert to `FunctionDeclaration` objects |
|
|
207
|
+
| **LangChain** | Use `StructuredTool.from_function()` or the Dominus Node LangChain integration |
|
|
208
|
+
| **Vercel AI SDK** | See the `integrations/vercel-ai/` package |
|
|
209
|
+
| **LlamaIndex** | Use `FunctionTool.from_defaults()` with the handler |
|
|
210
|
+
| **Ollama** | Pass as `tools` parameter in chat API |
|
|
211
211
|
|
|
212
212
|
## Security
|
|
213
213
|
|
|
@@ -224,6 +224,7 @@ Both handlers (TypeScript and Python) include comprehensive SSRF prevention that
|
|
|
224
224
|
### Header Injection Prevention
|
|
225
225
|
|
|
226
226
|
User-supplied HTTP headers are filtered to block:
|
|
227
|
+
|
|
227
228
|
- Security-sensitive headers (Host, Authorization, Proxy-Authorization, etc.)
|
|
228
229
|
- CRLF injection attempts (headers containing \r or \n)
|
|
229
230
|
- Null byte injection
|
|
@@ -248,18 +249,20 @@ Requests targeting OFAC-sanctioned countries (CU, IR, KP, RU, SY) are blocked at
|
|
|
248
249
|
|
|
249
250
|
## Proxy Pricing
|
|
250
251
|
|
|
251
|
-
| Proxy Type
|
|
252
|
-
|
|
252
|
+
| Proxy Type | Price | Best For |
|
|
253
|
+
| ----------------- | -------- | -------------------------------------- |
|
|
253
254
|
| Datacenter (`dc`) | $3.00/GB | General scraping, speed-critical tasks |
|
|
254
|
-
| Residential
|
|
255
|
+
| Residential | $5.00/GB | Anti-detection, geo-restricted content |
|
|
255
256
|
|
|
256
257
|
## Dependencies
|
|
257
258
|
|
|
258
259
|
### TypeScript Handler
|
|
260
|
+
|
|
259
261
|
- Node.js 18+ (uses native `fetch` and `AbortSignal.timeout`)
|
|
260
262
|
- No external dependencies
|
|
261
263
|
|
|
262
264
|
### Python Handler
|
|
265
|
+
|
|
263
266
|
- Python 3.8+
|
|
264
267
|
- `httpx` (`pip install httpx`)
|
|
265
268
|
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dominus Node OpenAI-compatible function calling handler (TypeScript).
|
|
3
3
|
*
|
|
4
|
+
* 57 tools covering proxy, wallet, usage, account lifecycle, API keys,
|
|
5
|
+
* plans, and teams.
|
|
6
|
+
*
|
|
4
7
|
* Provides a factory function that creates a handler for dispatching
|
|
5
8
|
* OpenAI function calls to the Dominus Node REST API. Works with any
|
|
6
9
|
* function-calling LLM system: OpenAI GPT, Anthropic Claude tool_use,
|