agentic-flow 1.2.7 → 1.3.1
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 +53 -3
- package/dist/agents/claudeAgent.js +19 -1
- package/dist/agents/directApiAgent.js +1 -1
- package/dist/cli/claude-code-wrapper.js +11 -2
- package/dist/cli-proxy.js +111 -12
- package/dist/cli-standalone-proxy.js +1 -1
- package/dist/proxy/anthropic-to-openrouter.js +184 -94
- package/dist/proxy/anthropic-to-requesty.js +627 -0
- package/dist/proxy/tool-emulation.js +365 -0
- package/dist/utils/modelCapabilities.js +276 -0
- package/docs/plans/agent-booster/00-INDEX.md +230 -0
- package/docs/plans/agent-booster/00-OVERVIEW.md +454 -0
- package/docs/plans/agent-booster/01-ARCHITECTURE.md +699 -0
- package/docs/plans/agent-booster/02-INTEGRATION.md +771 -0
- package/docs/plans/agent-booster/03-BENCHMARKS.md +616 -0
- package/docs/plans/agent-booster/04-NPM-SDK.md +673 -0
- package/docs/plans/agent-booster/GITHUB-ISSUE.md +523 -0
- package/docs/plans/agent-booster/README.md +576 -0
- package/docs/plans/requesty/00-overview.md +176 -0
- package/docs/plans/requesty/01-api-research.md +573 -0
- package/docs/plans/requesty/02-architecture.md +1076 -0
- package/docs/plans/requesty/03-implementation-phases.md +1129 -0
- package/docs/plans/requesty/04-testing-strategy.md +905 -0
- package/docs/plans/requesty/05-migration-guide.md +576 -0
- package/docs/plans/requesty/README.md +290 -0
- package/package.json +1 -1
- package/dist/agents/sdkAgent.js +0 -151
- package/dist/examples/parallel-swarm-deployment.js +0 -171
- package/dist/utils/.claude-flow/metrics/agent-metrics.json +0 -1
- package/dist/utils/.claude-flow/metrics/performance.json +0 -9
- package/dist/utils/.claude-flow/metrics/task-metrics.json +0 -10
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
[](https://nodejs.org/)
|
|
7
7
|
[](https://github.com/ruvnet/)
|
|
8
8
|
|
|
9
|
-
**Production-ready AI agent orchestration with 66+ specialized agents, 213 MCP tools, and multi-model routing (Anthropic, OpenRouter, Gemini, ONNX).**
|
|
9
|
+
**Production-ready AI agent orchestration with 66+ specialized agents, 213 MCP tools, and multi-model routing (Anthropic, OpenRouter, Requesty, Gemini, ONNX).**
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
@@ -23,10 +23,10 @@ Extending agent capabilities is effortless. Add custom tools and integrations th
|
|
|
23
23
|
Define routing rules through flexible policy modes: Strict mode keeps sensitive data offline, Economy mode prefers free models (99% savings), Premium mode uses Anthropic for highest quality, or create custom cost/quality thresholds. The policy defines the rules; the swarm enforces them automatically. Runs local for development, Docker for CI/CD, or Flow Nexus cloud for production scale. Agentic Flow is the framework for autonomous efficiency—one unified runner for every Claude Code agent, self-tuning, self-routing, and built for real-world deployment.
|
|
24
24
|
|
|
25
25
|
**Key Capabilities:**
|
|
26
|
-
- ✅ **Claude Code Mode** - Run Claude Code with OpenRouter/Gemini/ONNX (85-99% savings)
|
|
26
|
+
- ✅ **Claude Code Mode** - Run Claude Code with OpenRouter/Requesty/Gemini/ONNX (85-99% savings)
|
|
27
27
|
- ✅ **66 Specialized Agents** - Pre-built experts for coding, research, review, testing, DevOps
|
|
28
28
|
- ✅ **213 MCP Tools** - Memory, GitHub, neural networks, sandboxes, workflows, payments
|
|
29
|
-
- ✅ **Multi-Model Router** - Anthropic, OpenRouter (100+ models), Gemini, ONNX (free local)
|
|
29
|
+
- ✅ **Multi-Model Router** - Anthropic, OpenRouter (100+ models), Requesty (300+ models), Gemini, ONNX (free local)
|
|
30
30
|
- ✅ **Cost Optimization** - DeepSeek at $0.14/M tokens vs Claude at $15/M (99% savings)
|
|
31
31
|
|
|
32
32
|
**Built On:**
|
|
@@ -56,6 +56,10 @@ npx agentic-flow --agent coder --task "Build a REST API with authentication"
|
|
|
56
56
|
export OPENROUTER_API_KEY=sk-or-v1-...
|
|
57
57
|
npx agentic-flow --agent coder --task "Build REST API" --model "meta-llama/llama-3.1-8b-instruct"
|
|
58
58
|
|
|
59
|
+
# Run with Requesty (300+ models, 95% cost savings)
|
|
60
|
+
export REQUESTY_API_KEY=sk-...
|
|
61
|
+
npx agentic-flow --agent coder --task "Build REST API" --provider requesty
|
|
62
|
+
|
|
59
63
|
# Run with Gemini (free tier)
|
|
60
64
|
export GOOGLE_GEMINI_API_KEY=AIza...
|
|
61
65
|
npx agentic-flow --agent coder --task "Build REST API" --provider gemini
|
|
@@ -129,14 +133,17 @@ Automatically spawns Claude Code with proxy configuration for OpenRouter, Gemini
|
|
|
129
133
|
```bash
|
|
130
134
|
# Interactive mode - Opens Claude Code UI with proxy
|
|
131
135
|
npx agentic-flow claude-code --provider openrouter
|
|
136
|
+
npx agentic-flow claude-code --provider requesty
|
|
132
137
|
npx agentic-flow claude-code --provider gemini
|
|
133
138
|
|
|
134
139
|
# Non-interactive mode - Execute task and exit
|
|
135
140
|
npx agentic-flow claude-code --provider openrouter "Write a Python hello world function"
|
|
141
|
+
npx agentic-flow claude-code --provider requesty "Write a Python hello world function"
|
|
136
142
|
npx agentic-flow claude-code --provider openrouter --model "deepseek/deepseek-chat" "Create REST API"
|
|
137
143
|
|
|
138
144
|
# Use specific models
|
|
139
145
|
npx agentic-flow claude-code --provider openrouter --model "mistralai/mistral-small"
|
|
146
|
+
npx agentic-flow claude-code --provider requesty --model "openai/gpt-4o-mini"
|
|
140
147
|
npx agentic-flow claude-code --provider gemini --model "gemini-2.0-flash-exp"
|
|
141
148
|
|
|
142
149
|
# Local ONNX models (100% free, privacy-focused)
|
|
@@ -148,6 +155,8 @@ npx agentic-flow claude-code --provider onnx "Analyze this codebase"
|
|
|
148
155
|
| Provider | Model | Cost/M Tokens | Context | Best For |
|
|
149
156
|
|----------|-------|---------------|---------|----------|
|
|
150
157
|
| OpenRouter | `deepseek/deepseek-chat` (default) | $0.14 | 128k | General tasks, best value |
|
|
158
|
+
| Requesty | `deepseek/deepseek-chat` | $0.14 | 128k | 300+ models, unified API |
|
|
159
|
+
| Requesty | `openai/gpt-4o-mini` | $0.15 | 128k | OpenAI models via Requesty |
|
|
151
160
|
| OpenRouter | `anthropic/claude-3.5-sonnet` | $3.00 | 200k | Highest quality, complex reasoning |
|
|
152
161
|
| OpenRouter | `google/gemini-2.0-flash-exp:free` | FREE | 1M | Development, testing (rate limited) |
|
|
153
162
|
| Gemini | `gemini-2.0-flash-exp` | FREE | 1M | Fast responses, rate limited |
|
|
@@ -169,6 +178,9 @@ npx agentic-flow claude-code --provider onnx "Analyze this codebase"
|
|
|
169
178
|
# OpenRouter (100+ models at 85-99% savings)
|
|
170
179
|
export OPENROUTER_API_KEY=sk-or-v1-...
|
|
171
180
|
|
|
181
|
+
# Requesty (300+ models, unified access)
|
|
182
|
+
export REQUESTY_API_KEY=sk-...
|
|
183
|
+
|
|
172
184
|
# Gemini (FREE tier available)
|
|
173
185
|
export GOOGLE_GEMINI_API_KEY=AIza...
|
|
174
186
|
|
|
@@ -1014,11 +1026,49 @@ export HEALTH_PORT=8080 # Health check port
|
|
|
1014
1026
|
# .env file (auto-loaded)
|
|
1015
1027
|
ANTHROPIC_API_KEY=sk-ant-...
|
|
1016
1028
|
OPENROUTER_API_KEY=sk-or-v1-...
|
|
1029
|
+
REQUESTY_API_KEY=sk-...
|
|
1017
1030
|
GOOGLE_GEMINI_API_KEY=AIza...
|
|
1018
1031
|
ENABLE_CLAUDE_FLOW_SDK=true
|
|
1019
1032
|
COMPLETION_MODEL=deepseek/deepseek-chat-v3.1
|
|
1020
1033
|
```
|
|
1021
1034
|
|
|
1035
|
+
**Requesty Configuration (v1.3.1+)**
|
|
1036
|
+
|
|
1037
|
+
Requesty.ai provides unified access to 300+ AI models including OpenAI (GPT-4o, GPT-4o-mini), Anthropic, DeepSeek, Meta, Mistral, and more through a single API key:
|
|
1038
|
+
|
|
1039
|
+
```bash
|
|
1040
|
+
# Get your API key from https://requesty.ai
|
|
1041
|
+
export REQUESTY_API_KEY=sk-...
|
|
1042
|
+
|
|
1043
|
+
# Use with agents
|
|
1044
|
+
npx agentic-flow --agent coder --task "your task" --provider requesty
|
|
1045
|
+
|
|
1046
|
+
# Use with Claude Code
|
|
1047
|
+
npx agentic-flow claude-code --provider requesty
|
|
1048
|
+
|
|
1049
|
+
# Specify model (default: deepseek/deepseek-chat)
|
|
1050
|
+
npx agentic-flow --agent coder --task "task" --provider requesty --model "openai/gpt-4o-mini"
|
|
1051
|
+
|
|
1052
|
+
# Enable via environment variable
|
|
1053
|
+
export USE_REQUESTY=true
|
|
1054
|
+
npx agentic-flow --agent coder --task "your task"
|
|
1055
|
+
```
|
|
1056
|
+
|
|
1057
|
+
**Supported Requesty Models:**
|
|
1058
|
+
- `deepseek/deepseek-chat` (default) - $0.14/M tokens, 128k context, native tools
|
|
1059
|
+
- `openai/gpt-4o` - $2.50/M tokens, 128k context, native tools
|
|
1060
|
+
- `openai/gpt-4o-mini` - $0.15/M tokens, 128k context, native tools
|
|
1061
|
+
- `openai/gpt-4-turbo` - $10/M tokens, 128k context, native tools
|
|
1062
|
+
- 300+ other models available
|
|
1063
|
+
|
|
1064
|
+
**Features:**
|
|
1065
|
+
- ✅ OpenAI-compatible API format
|
|
1066
|
+
- ✅ Native tool calling support for GPT-4o, DeepSeek
|
|
1067
|
+
- ✅ Automatic max_tokens optimization (capped at 8192)
|
|
1068
|
+
- ✅ 95% cost savings vs Anthropic direct API
|
|
1069
|
+
- ✅ Full MCP tool integration (all 213 tools)
|
|
1070
|
+
- ✅ Works with `--verbose` flag for debugging
|
|
1071
|
+
|
|
1022
1072
|
---
|
|
1023
1073
|
|
|
1024
1074
|
## 📚 Complete Agent List
|
|
@@ -8,6 +8,9 @@ function getCurrentProvider() {
|
|
|
8
8
|
if (process.env.PROVIDER === 'gemini' || process.env.USE_GEMINI === 'true') {
|
|
9
9
|
return 'gemini';
|
|
10
10
|
}
|
|
11
|
+
if (process.env.PROVIDER === 'requesty' || process.env.USE_REQUESTY === 'true') {
|
|
12
|
+
return 'requesty';
|
|
13
|
+
}
|
|
11
14
|
if (process.env.PROVIDER === 'openrouter' || process.env.USE_OPENROUTER === 'true') {
|
|
12
15
|
return 'openrouter';
|
|
13
16
|
}
|
|
@@ -24,9 +27,15 @@ function getModelForProvider(provider) {
|
|
|
24
27
|
apiKey: process.env.GOOGLE_GEMINI_API_KEY || process.env.ANTHROPIC_API_KEY || '',
|
|
25
28
|
baseURL: process.env.PROXY_URL || undefined
|
|
26
29
|
};
|
|
30
|
+
case 'requesty':
|
|
31
|
+
return {
|
|
32
|
+
model: process.env.COMPLETION_MODEL || 'deepseek/deepseek-chat',
|
|
33
|
+
apiKey: process.env.REQUESTY_API_KEY || process.env.ANTHROPIC_API_KEY || '',
|
|
34
|
+
baseURL: process.env.PROXY_URL || undefined
|
|
35
|
+
};
|
|
27
36
|
case 'openrouter':
|
|
28
37
|
return {
|
|
29
|
-
model: process.env.COMPLETION_MODEL || '
|
|
38
|
+
model: process.env.COMPLETION_MODEL || 'deepseek/deepseek-chat',
|
|
30
39
|
apiKey: process.env.OPENROUTER_API_KEY || process.env.ANTHROPIC_API_KEY || '',
|
|
31
40
|
baseURL: process.env.PROXY_URL || undefined
|
|
32
41
|
};
|
|
@@ -75,6 +84,15 @@ export async function claudeAgent(agent, input, onStream, modelOverride) {
|
|
|
75
84
|
model: finalModel
|
|
76
85
|
});
|
|
77
86
|
}
|
|
87
|
+
else if (provider === 'requesty' && process.env.REQUESTY_API_KEY) {
|
|
88
|
+
// Use ANTHROPIC_BASE_URL if already set by CLI (proxy mode)
|
|
89
|
+
envOverrides.ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY || 'proxy-key';
|
|
90
|
+
envOverrides.ANTHROPIC_BASE_URL = process.env.ANTHROPIC_BASE_URL || process.env.REQUESTY_PROXY_URL || 'http://localhost:3000';
|
|
91
|
+
logger.info('Using Requesty proxy', {
|
|
92
|
+
proxyUrl: envOverrides.ANTHROPIC_BASE_URL,
|
|
93
|
+
model: finalModel
|
|
94
|
+
});
|
|
95
|
+
}
|
|
78
96
|
else if (provider === 'openrouter' && process.env.OPENROUTER_API_KEY) {
|
|
79
97
|
// Use ANTHROPIC_BASE_URL if already set by CLI (proxy mode)
|
|
80
98
|
envOverrides.ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY || 'proxy-key';
|
|
@@ -250,7 +250,7 @@ export async function directApiAgent(agent, input, onStream) {
|
|
|
250
250
|
const params = {
|
|
251
251
|
model: provider === 'gemini'
|
|
252
252
|
? (process.env.COMPLETION_MODEL || 'gemini-2.0-flash-exp')
|
|
253
|
-
: (process.env.COMPLETION_MODEL || '
|
|
253
|
+
: (process.env.COMPLETION_MODEL || 'deepseek/deepseek-chat'),
|
|
254
254
|
messages: messagesWithSystem,
|
|
255
255
|
maxTokens: 8192,
|
|
256
256
|
temperature: 0.7
|
|
@@ -39,10 +39,19 @@ function getProxyConfig(provider, customPort) {
|
|
|
39
39
|
provider: 'openrouter',
|
|
40
40
|
port,
|
|
41
41
|
baseUrl,
|
|
42
|
-
model: process.env.COMPLETION_MODEL || '
|
|
42
|
+
model: process.env.COMPLETION_MODEL || 'deepseek/deepseek-chat',
|
|
43
43
|
apiKey: process.env.OPENROUTER_API_KEY || '',
|
|
44
44
|
requiresProxy: true
|
|
45
45
|
};
|
|
46
|
+
case 'requesty':
|
|
47
|
+
return {
|
|
48
|
+
provider: 'requesty',
|
|
49
|
+
port,
|
|
50
|
+
baseUrl,
|
|
51
|
+
model: process.env.COMPLETION_MODEL || 'deepseek/deepseek-chat',
|
|
52
|
+
apiKey: process.env.REQUESTY_API_KEY || '',
|
|
53
|
+
requiresProxy: true
|
|
54
|
+
};
|
|
46
55
|
case 'gemini':
|
|
47
56
|
return {
|
|
48
57
|
provider: 'gemini',
|
|
@@ -120,7 +129,7 @@ async function startProxyServer(config) {
|
|
|
120
129
|
proxy = new AnthropicToOpenRouterProxy({
|
|
121
130
|
openrouterApiKey: config.apiKey,
|
|
122
131
|
openrouterBaseUrl: process.env.ANTHROPIC_PROXY_BASE_URL,
|
|
123
|
-
defaultModel: config.model || '
|
|
132
|
+
defaultModel: config.model || 'deepseek/deepseek-chat'
|
|
124
133
|
});
|
|
125
134
|
}
|
|
126
135
|
// Start proxy
|
package/dist/cli-proxy.js
CHANGED
|
@@ -25,6 +25,7 @@ function loadEnvRecursive(startPath = process.cwd()) {
|
|
|
25
25
|
}
|
|
26
26
|
loadEnvRecursive();
|
|
27
27
|
import { AnthropicToOpenRouterProxy } from "./proxy/anthropic-to-openrouter.js";
|
|
28
|
+
import { AnthropicToRequestyProxy } from "./proxy/anthropic-to-requesty.js";
|
|
28
29
|
import { logger } from "./utils/logger.js";
|
|
29
30
|
import { parseArgs } from "./utils/cli.js";
|
|
30
31
|
import { getAgent, listAgents } from "./utils/agentLoader.js";
|
|
@@ -32,6 +33,7 @@ import { claudeAgent } from "./agents/claudeAgent.js";
|
|
|
32
33
|
import { handleConfigCommand } from "./cli/config-wizard.js";
|
|
33
34
|
import { handleAgentCommand } from "./cli/agent-manager.js";
|
|
34
35
|
import { ModelOptimizer } from "./utils/modelOptimizer.js";
|
|
36
|
+
import { detectModelCapabilities } from "./utils/modelCapabilities.js";
|
|
35
37
|
const __filename = fileURLToPath(import.meta.url);
|
|
36
38
|
const __dirname = dirname(__filename);
|
|
37
39
|
const packageJson = JSON.parse(readFileSync(pathResolve(__dirname, '../package.json'), 'utf-8'));
|
|
@@ -153,6 +155,7 @@ class AgenticFlowCLI {
|
|
|
153
155
|
const useONNX = this.shouldUseONNX(options);
|
|
154
156
|
const useOpenRouter = this.shouldUseOpenRouter(options);
|
|
155
157
|
const useGemini = this.shouldUseGemini(options);
|
|
158
|
+
const useRequesty = this.shouldUseRequesty(options);
|
|
156
159
|
// Debug output for provider selection
|
|
157
160
|
if (options.verbose || process.env.VERBOSE === 'true') {
|
|
158
161
|
console.log('\n🔍 Provider Selection Debug:');
|
|
@@ -161,16 +164,22 @@ class AgenticFlowCLI {
|
|
|
161
164
|
console.log(` Use ONNX: ${useONNX}`);
|
|
162
165
|
console.log(` Use OpenRouter: ${useOpenRouter}`);
|
|
163
166
|
console.log(` Use Gemini: ${useGemini}`);
|
|
167
|
+
console.log(` Use Requesty: ${useRequesty}`);
|
|
164
168
|
console.log(` OPENROUTER_API_KEY: ${process.env.OPENROUTER_API_KEY ? '✓ set' : '✗ not set'}`);
|
|
165
169
|
console.log(` GOOGLE_GEMINI_API_KEY: ${process.env.GOOGLE_GEMINI_API_KEY ? '✓ set' : '✗ not set'}`);
|
|
170
|
+
console.log(` REQUESTY_API_KEY: ${process.env.REQUESTY_API_KEY ? '✓ set' : '✗ not set'}`);
|
|
166
171
|
console.log(` ANTHROPIC_API_KEY: ${process.env.ANTHROPIC_API_KEY ? '✓ set' : '✗ not set'}\n`);
|
|
167
172
|
}
|
|
168
173
|
try {
|
|
169
|
-
// Start proxy if needed (ONNX, OpenRouter, or
|
|
174
|
+
// Start proxy if needed (ONNX, OpenRouter, Gemini, or Requesty)
|
|
170
175
|
if (useONNX) {
|
|
171
176
|
console.log('🚀 Initializing ONNX local inference proxy...');
|
|
172
177
|
await this.startONNXProxy(options.model);
|
|
173
178
|
}
|
|
179
|
+
else if (useRequesty) {
|
|
180
|
+
console.log('🚀 Initializing Requesty proxy...');
|
|
181
|
+
await this.startRequestyProxy(options.model);
|
|
182
|
+
}
|
|
174
183
|
else if (useOpenRouter) {
|
|
175
184
|
console.log('🚀 Initializing OpenRouter proxy...');
|
|
176
185
|
await this.startOpenRouterProxy(options.model);
|
|
@@ -183,7 +192,7 @@ class AgenticFlowCLI {
|
|
|
183
192
|
console.log('🚀 Using direct Anthropic API...\n');
|
|
184
193
|
}
|
|
185
194
|
// Run agent
|
|
186
|
-
await this.runAgent(options, useOpenRouter, useGemini, useONNX);
|
|
195
|
+
await this.runAgent(options, useOpenRouter, useGemini, useONNX, useRequesty);
|
|
187
196
|
logger.info('Execution completed successfully');
|
|
188
197
|
process.exit(0);
|
|
189
198
|
}
|
|
@@ -226,14 +235,30 @@ class AgenticFlowCLI {
|
|
|
226
235
|
}
|
|
227
236
|
return false;
|
|
228
237
|
}
|
|
238
|
+
shouldUseRequesty(options) {
|
|
239
|
+
// Use Requesty if:
|
|
240
|
+
// 1. Provider is explicitly set to requesty
|
|
241
|
+
// 2. PROVIDER env var is set to requesty
|
|
242
|
+
// 3. USE_REQUESTY env var is set
|
|
243
|
+
if (options.provider === 'requesty' || process.env.PROVIDER === 'requesty') {
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
if (process.env.USE_REQUESTY === 'true') {
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
229
251
|
shouldUseOpenRouter(options) {
|
|
230
|
-
// Don't use OpenRouter if ONNX or
|
|
252
|
+
// Don't use OpenRouter if ONNX, Gemini, or Requesty is explicitly requested
|
|
231
253
|
if (options.provider === 'onnx' || process.env.USE_ONNX === 'true' || process.env.PROVIDER === 'onnx') {
|
|
232
254
|
return false;
|
|
233
255
|
}
|
|
234
256
|
if (options.provider === 'gemini' || process.env.PROVIDER === 'gemini') {
|
|
235
257
|
return false;
|
|
236
258
|
}
|
|
259
|
+
if (options.provider === 'requesty' || process.env.PROVIDER === 'requesty') {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
237
262
|
// Use OpenRouter if:
|
|
238
263
|
// 1. Provider is explicitly set to openrouter
|
|
239
264
|
// 2. Model parameter contains "/" (e.g., "meta-llama/llama-3.1-8b-instruct")
|
|
@@ -264,11 +289,13 @@ class AgenticFlowCLI {
|
|
|
264
289
|
const defaultModel = modelOverride ||
|
|
265
290
|
process.env.COMPLETION_MODEL ||
|
|
266
291
|
process.env.REASONING_MODEL ||
|
|
267
|
-
'
|
|
292
|
+
'deepseek/deepseek-chat';
|
|
293
|
+
const capabilities = detectModelCapabilities(defaultModel);
|
|
268
294
|
const proxy = new AnthropicToOpenRouterProxy({
|
|
269
295
|
openrouterApiKey: openrouterKey,
|
|
270
296
|
openrouterBaseUrl: process.env.ANTHROPIC_PROXY_BASE_URL,
|
|
271
|
-
defaultModel
|
|
297
|
+
defaultModel,
|
|
298
|
+
capabilities: capabilities
|
|
272
299
|
});
|
|
273
300
|
// Start proxy in background
|
|
274
301
|
proxy.start(this.proxyPort);
|
|
@@ -281,7 +308,13 @@ class AgenticFlowCLI {
|
|
|
281
308
|
}
|
|
282
309
|
console.log(`🔗 Proxy Mode: OpenRouter`);
|
|
283
310
|
console.log(`🔧 Proxy URL: http://localhost:${this.proxyPort}`);
|
|
284
|
-
console.log(`🤖 Default Model: ${defaultModel}
|
|
311
|
+
console.log(`🤖 Default Model: ${defaultModel}`);
|
|
312
|
+
if (capabilities.requiresEmulation) {
|
|
313
|
+
console.log(`\n⚙️ Detected: Model lacks native tool support`);
|
|
314
|
+
console.log(`🔧 Using ${capabilities.emulationStrategy.toUpperCase()} emulation pattern`);
|
|
315
|
+
console.log(`📊 Expected reliability: ${capabilities.emulationStrategy === 'react' ? '70-85%' : '50-70%'}`);
|
|
316
|
+
}
|
|
317
|
+
console.log('');
|
|
285
318
|
// Wait for proxy to be ready
|
|
286
319
|
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
287
320
|
}
|
|
@@ -317,6 +350,46 @@ class AgenticFlowCLI {
|
|
|
317
350
|
// Wait for proxy to be ready
|
|
318
351
|
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
319
352
|
}
|
|
353
|
+
async startRequestyProxy(modelOverride) {
|
|
354
|
+
const requestyKey = process.env.REQUESTY_API_KEY;
|
|
355
|
+
if (!requestyKey) {
|
|
356
|
+
console.error('❌ Error: REQUESTY_API_KEY required for Requesty models');
|
|
357
|
+
console.error('Set it in .env or export REQUESTY_API_KEY=sk-xxxxx');
|
|
358
|
+
process.exit(1);
|
|
359
|
+
}
|
|
360
|
+
logger.info('Starting integrated Requesty proxy');
|
|
361
|
+
const defaultModel = modelOverride ||
|
|
362
|
+
process.env.COMPLETION_MODEL ||
|
|
363
|
+
process.env.REASONING_MODEL ||
|
|
364
|
+
'deepseek/deepseek-chat';
|
|
365
|
+
const capabilities = detectModelCapabilities(defaultModel);
|
|
366
|
+
const proxy = new AnthropicToRequestyProxy({
|
|
367
|
+
requestyApiKey: requestyKey,
|
|
368
|
+
requestyBaseUrl: process.env.REQUESTY_BASE_URL,
|
|
369
|
+
defaultModel,
|
|
370
|
+
capabilities: capabilities
|
|
371
|
+
});
|
|
372
|
+
// Start proxy in background
|
|
373
|
+
proxy.start(this.proxyPort);
|
|
374
|
+
this.proxyServer = proxy;
|
|
375
|
+
// Set ANTHROPIC_BASE_URL to proxy
|
|
376
|
+
process.env.ANTHROPIC_BASE_URL = `http://localhost:${this.proxyPort}`;
|
|
377
|
+
// Set dummy ANTHROPIC_API_KEY for proxy (actual auth uses REQUESTY_API_KEY)
|
|
378
|
+
if (!process.env.ANTHROPIC_API_KEY) {
|
|
379
|
+
process.env.ANTHROPIC_API_KEY = 'sk-ant-proxy-dummy-key';
|
|
380
|
+
}
|
|
381
|
+
console.log(`🔗 Proxy Mode: Requesty`);
|
|
382
|
+
console.log(`🔧 Proxy URL: http://localhost:${this.proxyPort}`);
|
|
383
|
+
console.log(`🤖 Default Model: ${defaultModel}`);
|
|
384
|
+
if (capabilities.requiresEmulation) {
|
|
385
|
+
console.log(`\n⚙️ Detected: Model lacks native tool support`);
|
|
386
|
+
console.log(`🔧 Using ${capabilities.emulationStrategy.toUpperCase()} emulation pattern`);
|
|
387
|
+
console.log(`📊 Expected reliability: ${capabilities.emulationStrategy === 'react' ? '70-85%' : '50-70%'}`);
|
|
388
|
+
}
|
|
389
|
+
console.log('');
|
|
390
|
+
// Wait for proxy to be ready
|
|
391
|
+
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
392
|
+
}
|
|
320
393
|
async startONNXProxy(modelOverride) {
|
|
321
394
|
logger.info('Starting integrated ONNX local inference proxy');
|
|
322
395
|
console.log('🔧 Provider: ONNX Local (Phi-4-mini)');
|
|
@@ -416,7 +489,7 @@ Get your key at: https://openrouter.ai/keys
|
|
|
416
489
|
`);
|
|
417
490
|
process.exit(1);
|
|
418
491
|
}
|
|
419
|
-
const finalModel = model || process.env.COMPLETION_MODEL || '
|
|
492
|
+
const finalModel = model || process.env.COMPLETION_MODEL || 'deepseek/deepseek-chat';
|
|
420
493
|
console.log(`🚀 Starting OpenRouter → Anthropic Proxy
|
|
421
494
|
📍 Port: ${port}
|
|
422
495
|
🤖 Model: ${finalModel}
|
|
@@ -485,7 +558,7 @@ EXAMPLES:
|
|
|
485
558
|
claude
|
|
486
559
|
`);
|
|
487
560
|
}
|
|
488
|
-
async runAgent(options, useOpenRouter, useGemini, useONNX = false) {
|
|
561
|
+
async runAgent(options, useOpenRouter, useGemini, useONNX = false, useRequesty = false) {
|
|
489
562
|
const agentName = options.agent || process.env.AGENT || '';
|
|
490
563
|
const task = options.task || process.env.TASK || '';
|
|
491
564
|
if (!agentName) {
|
|
@@ -504,12 +577,24 @@ EXAMPLES:
|
|
|
504
577
|
}
|
|
505
578
|
// Check for API key (unless using ONNX)
|
|
506
579
|
const isOnnx = options.provider === 'onnx' || process.env.USE_ONNX === 'true' || process.env.PROVIDER === 'onnx';
|
|
507
|
-
if (!isOnnx && !useOpenRouter && !useGemini && !process.env.ANTHROPIC_API_KEY) {
|
|
580
|
+
if (!isOnnx && !useOpenRouter && !useGemini && !useRequesty && !process.env.ANTHROPIC_API_KEY) {
|
|
508
581
|
console.error('\n❌ Error: ANTHROPIC_API_KEY is required\n');
|
|
509
582
|
console.error('Please set your API key:');
|
|
510
583
|
console.error(' export ANTHROPIC_API_KEY=sk-ant-xxxxx\n');
|
|
511
584
|
console.error('Or use alternative providers:');
|
|
512
585
|
console.error(' --provider openrouter (requires OPENROUTER_API_KEY)');
|
|
586
|
+
console.error(' --provider requesty (requires REQUESTY_API_KEY)');
|
|
587
|
+
console.error(' --provider gemini (requires GOOGLE_GEMINI_API_KEY)');
|
|
588
|
+
console.error(' --provider onnx (free local inference)\n');
|
|
589
|
+
process.exit(1);
|
|
590
|
+
}
|
|
591
|
+
if (!isOnnx && useRequesty && !process.env.REQUESTY_API_KEY) {
|
|
592
|
+
console.error('\n❌ Error: REQUESTY_API_KEY is required for Requesty\n');
|
|
593
|
+
console.error('Please set your API key:');
|
|
594
|
+
console.error(' export REQUESTY_API_KEY=sk-xxxxx\n');
|
|
595
|
+
console.error('Or use alternative providers:');
|
|
596
|
+
console.error(' --provider anthropic (requires ANTHROPIC_API_KEY)');
|
|
597
|
+
console.error(' --provider openrouter (requires OPENROUTER_API_KEY)');
|
|
513
598
|
console.error(' --provider gemini (requires GOOGLE_GEMINI_API_KEY)');
|
|
514
599
|
console.error(' --provider onnx (free local inference)\n');
|
|
515
600
|
process.exit(1);
|
|
@@ -520,6 +605,7 @@ EXAMPLES:
|
|
|
520
605
|
console.error(' export OPENROUTER_API_KEY=sk-or-v1-xxxxx\n');
|
|
521
606
|
console.error('Or use alternative providers:');
|
|
522
607
|
console.error(' --provider anthropic (requires ANTHROPIC_API_KEY)');
|
|
608
|
+
console.error(' --provider requesty (requires REQUESTY_API_KEY)');
|
|
523
609
|
console.error(' --provider gemini (requires GOOGLE_GEMINI_API_KEY)');
|
|
524
610
|
console.error(' --provider onnx (free local inference)\n');
|
|
525
611
|
process.exit(1);
|
|
@@ -551,9 +637,17 @@ EXAMPLES:
|
|
|
551
637
|
console.log(`📝 Description: ${agent.description}\n`);
|
|
552
638
|
console.log(`🎯 Task: ${task}\n`);
|
|
553
639
|
if (useOpenRouter) {
|
|
554
|
-
const model = options.model || process.env.COMPLETION_MODEL || '
|
|
640
|
+
const model = options.model || process.env.COMPLETION_MODEL || 'deepseek/deepseek-chat';
|
|
555
641
|
console.log(`🔧 Provider: OpenRouter (via proxy)`);
|
|
556
|
-
console.log(`🔧 Model: ${model}
|
|
642
|
+
console.log(`🔧 Model: ${model}`);
|
|
643
|
+
// Show tool capability information
|
|
644
|
+
const capabilities = detectModelCapabilities(model);
|
|
645
|
+
if (capabilities.requiresEmulation) {
|
|
646
|
+
console.log(`⚙️ Tool Emulation: ${capabilities.emulationStrategy.toUpperCase()} pattern`);
|
|
647
|
+
console.log(`📊 Note: This model uses prompt-based tool emulation`);
|
|
648
|
+
console.log(` Tools are handled by Claude Agent SDK (limited to SDK tools)`);
|
|
649
|
+
}
|
|
650
|
+
console.log('');
|
|
557
651
|
}
|
|
558
652
|
else if (useGemini) {
|
|
559
653
|
const model = options.model || 'gemini-2.0-flash-exp';
|
|
@@ -648,7 +742,7 @@ AGENT COMMANDS:
|
|
|
648
742
|
OPTIONS:
|
|
649
743
|
--task, -t <task> Task description for agent mode
|
|
650
744
|
--model, -m <model> Model to use (triggers OpenRouter if contains "/")
|
|
651
|
-
--provider, -p <name> Provider to use (anthropic, openrouter, gemini, onnx)
|
|
745
|
+
--provider, -p <name> Provider to use (anthropic, openrouter, requesty, gemini, onnx)
|
|
652
746
|
--stream, -s Enable real-time streaming output
|
|
653
747
|
--help, -h Show this help message
|
|
654
748
|
|
|
@@ -695,16 +789,19 @@ EXAMPLES:
|
|
|
695
789
|
|
|
696
790
|
# Proxy Server for Claude Code/Cursor
|
|
697
791
|
npx agentic-flow proxy --provider openrouter --port 3000
|
|
792
|
+
npx agentic-flow proxy --provider requesty --port 3000
|
|
698
793
|
npx agentic-flow proxy --provider gemini --port 3001
|
|
699
794
|
|
|
700
795
|
# Claude Code Integration (Auto-start proxy + spawn Claude Code)
|
|
701
796
|
npx agentic-flow claude-code --provider openrouter "Write a Python function"
|
|
797
|
+
npx agentic-flow claude-code --provider requesty "Write a Python function"
|
|
702
798
|
npx agentic-flow claude-code --provider gemini "Create a REST API"
|
|
703
799
|
npx agentic-flow claude-code --provider anthropic "Help me debug this code"
|
|
704
800
|
|
|
705
801
|
# Agent Execution
|
|
706
802
|
npx agentic-flow --list # List all 150+ agents
|
|
707
803
|
npx agentic-flow --agent coder --task "Create Python hello world"
|
|
804
|
+
npx agentic-flow --agent coder --task "Create REST API" --provider requesty
|
|
708
805
|
npx agentic-flow --agent coder --task "Create REST API" --model "meta-llama/llama-3.1-8b-instruct"
|
|
709
806
|
npx agentic-flow --agent coder --task "Create code" --provider onnx
|
|
710
807
|
|
|
@@ -717,8 +814,10 @@ EXAMPLES:
|
|
|
717
814
|
ENVIRONMENT VARIABLES:
|
|
718
815
|
ANTHROPIC_API_KEY Anthropic API key (for Claude models)
|
|
719
816
|
OPENROUTER_API_KEY OpenRouter API key (for alternative models)
|
|
817
|
+
REQUESTY_API_KEY Requesty API key (for Requesty models - 300+ models)
|
|
720
818
|
GOOGLE_GEMINI_API_KEY Google Gemini API key (for Gemini models)
|
|
721
819
|
USE_OPENROUTER Set to 'true' to force OpenRouter usage
|
|
820
|
+
USE_REQUESTY Set to 'true' to force Requesty usage
|
|
722
821
|
USE_GEMINI Set to 'true' to force Gemini usage
|
|
723
822
|
COMPLETION_MODEL Default model for OpenRouter
|
|
724
823
|
AGENTS_DIR Path to agents directory
|
|
@@ -153,7 +153,7 @@ Get your key at: https://openrouter.ai/keys
|
|
|
153
153
|
`);
|
|
154
154
|
process.exit(1);
|
|
155
155
|
}
|
|
156
|
-
const model = options.model || process.env.COMPLETION_MODEL || '
|
|
156
|
+
const model = options.model || process.env.COMPLETION_MODEL || 'deepseek/deepseek-chat';
|
|
157
157
|
console.log(`🚀 Starting OpenRouter → Anthropic Proxy
|
|
158
158
|
📍 Port: ${options.port}
|
|
159
159
|
🤖 Model: ${model}
|