23f7624596
ADR-166 MCP Bridge Security Lock / Static-source security lock (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / Compose default binds loopback + Mongo has auth (push) Failing after 2s
CodeQL Advanced / Analyze (rust) (push) Failing after 0s
ADR-166 MCP Bridge Security Lock / plugin-agent-federation bindHost default (push) Failing after 1s
ADR-166 MCP Bridge Security Lock / Runtime behavior — 401 + terminal gate + fail-closed (push) Failing after 4s
business-pods-smoke / smoke (push) Failing after 1s
all-plugins-smoke / smoke-all (push) Failing after 2s
CI/CD Pipeline / Security & Code Quality (push) Failing after 1s
CI/CD Pipeline / Test Suite (ubuntu-latest) (push) Failing after 1s
CI/CD Pipeline / Build & Package (macos-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (ubuntu-latest) (push) Has been skipped
CI/CD Pipeline / Build & Package (windows-latest) (push) Has been skipped
CI/CD Pipeline / Documentation & Examples (push) Failing after 1s
Clone Tracker (14-day rolling) / Snapshot clones for ruflo ecosystem (push) Failing after 1s
CodeQL Advanced / Analyze (actions) (push) Failing after 1s
CodeQL Advanced / Analyze (javascript-typescript) (push) Failing after 1s
federation-peer-rust / stable-noop (push) Failing after 1s
metaharness-ci / score (push) Failing after 1s
metaharness-ci / router-compat (push) Failing after 0s
metaharness-ci / similarity-tests (push) Failing after 0s
no-agentbbs-smoke / smoke-without-agentbbs (push) Failing after 1s
V3 CI/CD Pipeline / Build V3 (windows-latest) (push) Has been skipped
codex-integration-audit / Codex integration audit (push) Failing after 1s
helpers-manifest-guard / guard (push) Failing after 1s
🔗 Cross-Agent Integration Tests / 🤝 Agent Coordination Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🧠 Memory Sharing Integration (push) Has been skipped
🔗 Cross-Agent Integration Tests / 🛡️ Fault Tolerance Tests (push) Has been skipped
🔗 Cross-Agent Integration Tests / ⚡ Performance Integration Tests (push) Has been skipped
metaharness-ci / mcp-scan (push) Failing after 1s
metaharness-ci / eject-dryrun (push) Failing after 1s
metaharness-ci / metaharness-real-data (push) Failing after 0s
no-cli-optdep-bloat-2561 / guard (push) Failing after 1s
no-metaharness-smoke / smoke-without-metaharness (push) Failing after 1s
no-phantom-agentic-flow-subpath / guard (push) Failing after 1s
🔄 Automated Rollback Manager / 🚨 Failure Detection (push) Failing after 1s
V3 CI/CD Pipeline / Plugin hooks smoke / ubuntu-latest / Node 22 (push) Failing after 1s
V3 CI/CD Pipeline / ruflo-graph-intelligence build + test smoke (#2044, ADR-123) (push) Failing after 1s
CVE Audit Gate / Audit root (critical-blocking) (push) Failing after 2s
cost-tracker-smoke / smoke (push) Failing after 3s
oia-audit-weekly / audit (push) Failing after 2s
ruflo-agent-smoke / ruflo-agent structural smoke (push) Failing after 1s
📊 Status Badges Update / 📊 Update Status Badges (push) Failing after 1s
V3 CI/CD Pipeline / Static regression guards (#2267 YAML + (push) Failing after 1s
V3 CI/CD Pipeline / Test V3 Packages (push) Failing after 0s
V3 CI/CD Pipeline / agent_execute provider routing smoke (#2042) (push) Failing after 0s
CVE Audit Gate / Audit v3 (critical-blocking) (push) Failing after 1s
federation-peer-rust / stable-native (push) Failing after 2s
🔗 Cross-Agent Integration Tests / 🚀 Integration Test Setup (push) Failing after 2s
neural-trader-smoke / runtime-smoke (push) Failing after 1s
V3 CI/CD Pipeline / Build V3 (macos-latest) (push) Has been skipped
V3 CI/CD Pipeline / Build V3 (ubuntu-latest) (push) Has been skipped
V3 CI/CD Pipeline / Type Check V3 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 24 (push) Failing after 1s
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / ubuntu-latest / Node 22 (push) Failing after 2s
V3 CI/CD Pipeline / browser rvf create flag smoke (#2015) (push) Failing after 0s
V3 CI/CD Pipeline / Dependency review (#2046) (push) Has been skipped
V3 CI/CD Pipeline / Supply-chain audit (#2046) (push) Failing after 0s
V3 CI/CD Pipeline / witness marker drift smoke (#2021) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader portfolio CG smoke (#2068, ADR-126 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / neural-trader backtest signing smoke (#2068, ADR-126 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / kg-extract type-import classification smoke (#2049) (push) Failing after 0s
V3 CI/CD Pipeline / witness verify precondition smoke (#1880) (push) Failing after 2s
V3 CI/CD Pipeline / neural-trader pipeline risk-gate smoke (#2068, ADR-126 Phase 5) (push) Failing after 0s
V3 CI/CD Pipeline / neural-trader feature attribution smoke (#2068, ADR-126 Phase 6) (push) Failing after 0s
V3 CI/CD Pipeline / plugin-registry signature verification smoke (#1922, CWE-347) (push) Failing after 4s
V3 CI/CD Pipeline / memory stats legacy-DB smoke (#2120) (push) Failing after 4s
V3 CI/CD Pipeline / github deprecated actions smoke (#2089, ADR-127 Phase 3) (push) Failing after 1s
V3 CI/CD Pipeline / graph query + pathfinder smoke (ADR-130 P2+P5) (push) Has been skipped
V3 CI/CD Pipeline / graph trajectory hooks smoke (ADR-130 P3) (push) Has been skipped
V3 CI/CD Pipeline / graph plugin adapter smoke (ADR-130 P4) (push) Has been skipped
V3 CI/CD Pipeline / graph benchmark (ADR-130 P6) (push) Has been skipped
V3 CI/CD Pipeline / statusline generator delegation smoke (#2195) (push) Failing after 1s
V3 CI/CD Pipeline / wizard init regression guard (#2206 (push) Failing after 1s
V3 CI/CD Pipeline / memory no-stray-db smoke (ADR-125 P7) (push) Failing after 1s
V3 CI/CD Pipeline / github-safe injection smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github actions pin smoke (#2089, ADR-127 Phase 1) (push) Failing after 1s
V3 CI/CD Pipeline / github attribution opt-in smoke (#2089, ADR-127 Phase 4) (push) Failing after 1s
V3 CI/CD Pipeline / pre-bash hook safety smoke (#2017) (push) Failing after 1s
V3 CI/CD Pipeline / Memory import smoke / ubuntu-latest (push) Failing after 0s
V3 CI/CD Pipeline / MCP protocol smoke / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / ruvllm WASM auto-init smoke (#2086) (push) Failing after 4s
V3 CI/CD Pipeline / MCP paired-tool round-trip smoke (#1889) (push) Failing after 1s
V3 CI/CD Pipeline / Plugin package install-safety (#1902/#1903/#1904) (push) Failing after 1s
V3 CI/CD Pipeline / Tool description discoverability (ADR-112) (push) Failing after 3s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (22) (push) Failing after 1s
V3 CI/CD Pipeline / CLI npx-install smoke (#1147 / (24) (push) Failing after 1s
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / ubuntu-latest (push) Failing after 2s
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / ubuntu-latest (push) Failing after 1s
V3 CI/CD Pipeline / Vector-index dimension audit (#1947) (push) Failing after 0s
V3 CI/CD Pipeline / Hook-command install safety (#1921) (push) Failing after 1s
V3 CI/CD Pipeline / ToolOutputGuardrail smoke (ADR-131, (push) Failing after 1s
V3 CI/CD Pipeline / init-bundle invariants smoke (#2095, ADR-128 Phase 5) (push) Failing after 1s
V3 CI/CD Pipeline / wasm provider bridge smoke (ADR-129 P1) (push) Failing after 2s
V3 CI/CD Pipeline / wasm gallery CRUD smoke (ADR-129 P3) (push) Failing after 1s
V3 CI/CD Pipeline / wasm plugin bridge smoke (ADR-129 P4) (push) Failing after 0s
V3 CI/CD Pipeline / wasm compose smoke (ADR-129 P2) (push) Failing after 4s
V3 CI/CD Pipeline / graph schema smoke (ADR-130 P1) (push) Failing after 0s
Validate Marketplace / validate (push) Failing after 1s
🔍 Verification Pipeline / 🚀 Setup Verification (push) Failing after 1s
🔍 Verification Pipeline / 🛡️ Security Verification (push) Has been skipped
🔍 Verification Pipeline / 📝 Code Quality (push) Has been skipped
🔍 Verification Pipeline / 🧪 Test Verification (${{ matrix.os }}, Node ${{ matrix.node }}) (push) Has been skipped
🔍 Verification Pipeline / 🏗️ Build Verification (push) Has been skipped
🔍 Verification Pipeline / 📚 Documentation Verification (push) Has been skipped
CVE Audit Gate / High-severity report (warn only) (push) Has been cancelled
🔄 Automated Rollback Manager / 🔄 Execute Rollback (push) Has been cancelled
🔄 Automated Rollback Manager / ✅ Post-Rollback Verification (push) Has been cancelled
🔄 Automated Rollback Manager / 📊 Rollback Monitoring (push) Has been cancelled
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook execution smoke (#2132) / windows-latest (push) Has been cancelled
🔄 Automated Rollback Manager / ⏳ Manual Rollback Approval (push) Has been cancelled
V3 CI/CD Pipeline / MCP protocol smoke / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Memory import smoke / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows hook shim smoke (#2132) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Windows init hooks smoke (#2132) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / macos-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / ubuntu-latest (push) Has been cancelled
V3 CI/CD Pipeline / Witness verify (signed manifest) / windows-latest (push) Has been cancelled
V3 CI/CD Pipeline / Publish to npm (alpha) (push) Has been cancelled
V3 CI/CD Pipeline / Smoke (no better-sqlite3) / macos-latest / Node 22 (push) Has been cancelled
V3 CI/CD Pipeline / Plugin hooks smoke / macos-latest / Node 22 (push) Has been cancelled
CI/CD Pipeline / Deploy & Release (push) Has been cancelled
CI/CD Pipeline / CI Status (push) Has been cancelled
🔗 Cross-Agent Integration Tests / 📊 Integration Test Report (push) Has been cancelled
🔄 Automated Rollback Manager / 🔍 Pre-Rollback Validation (push) Has been cancelled
🔍 Verification Pipeline / ⚡ Performance Verification (push) Has been cancelled
🔍 Verification Pipeline / 📊 Verification Report (push) Has been cancelled
@claude-flow/providers
Multi-LLM Provider System for Claude Flow V3 - unified interface for Anthropic, OpenAI, Google, Cohere, Ollama, and RuVector with intelligent load balancing, automatic failover, and cost optimization.
Features
- 6+ LLM Providers - Anthropic, OpenAI, Google, Cohere, Ollama, RuVector
- Load Balancing - Round-robin, latency-based, least-loaded, cost-based strategies
- Automatic Failover - Seamless provider switching on failures
- Request Caching - LRU cache with configurable TTL
- Cost Optimization - Up to 85%+ savings with intelligent routing
- Streaming Support - Full streaming for all providers
- Tool Calling - Unified tool/function calling interface
- Health Monitoring - Real-time provider health checks
- Cost Tracking - Per-request and aggregate cost metrics
Supported Providers & Models
Anthropic (Claude)
claude-3-5-sonnet-20241022,claude-3-5-sonnet-latestclaude-3-opus-20240229claude-3-sonnet-20240229claude-3-haiku-20240307
OpenAI (GPT)
gpt-4o,gpt-4o-minigpt-4-turbo,gpt-4gpt-3.5-turboo1-preview,o1-mini,o3-mini
Google (Gemini)
gemini-2.0-flashgemini-1.5-pro,gemini-1.5-flashgemini-pro
Cohere
command-r-plus,command-rcommand-light,command
Ollama (Local)
llama3.2,llama3.1mistral,mixtralcodellama,phi-4deepseek-coder
RuVector
- Custom models via @ruvector/ruvllm
Installation
npm install @claude-flow/providers
Quick Start
import { createProviderManager } from '@claude-flow/providers';
// Create provider manager with multiple providers
const manager = await createProviderManager({
providers: [
{
provider: 'anthropic',
apiKey: process.env.ANTHROPIC_API_KEY!,
model: 'claude-3-5-sonnet-latest',
},
{
provider: 'openai',
apiKey: process.env.OPENAI_API_KEY!,
model: 'gpt-4o',
},
],
loadBalancing: {
enabled: true,
strategy: 'cost-based',
},
fallback: {
enabled: true,
maxAttempts: 2,
},
cache: {
enabled: true,
ttl: 300000,
maxSize: 1000,
},
});
// Make a completion request
const response = await manager.complete({
messages: [
{ role: 'user', content: 'Hello, how are you?' }
],
maxTokens: 100,
});
console.log('Response:', response.content);
console.log('Provider:', response.provider);
console.log('Cost:', response.cost?.totalCost);
API Reference
ProviderManager
import { ProviderManager, createProviderManager } from '@claude-flow/providers';
// Create and initialize
const manager = await createProviderManager(config);
// Or manually initialize
const manager = new ProviderManager(config);
await manager.initialize();
Methods
// Complete a request
const response = await manager.complete(request, preferredProvider?);
// Stream completion
for await (const event of manager.streamComplete(request, preferredProvider?)) {
if (event.type === 'content') {
process.stdout.write(event.delta?.content || '');
}
}
// Health check all providers
const health = await manager.healthCheck();
health.forEach((result, provider) => {
console.log(`${provider}: ${result.healthy ? 'OK' : 'FAIL'}`);
});
// Estimate costs across providers
const estimates = await manager.estimateCost(request);
estimates.forEach((estimate, provider) => {
console.log(`${provider}: $${estimate.estimatedCost.total.toFixed(4)}`);
});
// Get aggregated usage
const usage = await manager.getUsage('day');
console.log(`Total cost: $${usage.cost.total}`);
// Get provider metrics
const metrics = manager.getMetrics();
metrics.forEach((m, provider) => {
console.log(`${provider}: ${m.latency}ms avg, ${m.errorRate * 100}% errors`);
});
// List available providers
const providers = manager.listProviders();
// Get specific provider
const anthropic = manager.getProvider('anthropic');
// Clear cache
manager.clearCache();
// Shutdown
manager.destroy();
Individual Providers
import {
AnthropicProvider,
OpenAIProvider,
GoogleProvider,
CohereProvider,
OllamaProvider,
RuVectorProvider,
} from '@claude-flow/providers';
// Create provider directly
const anthropic = new AnthropicProvider({
config: {
provider: 'anthropic',
apiKey: process.env.ANTHROPIC_API_KEY!,
model: 'claude-3-5-sonnet-latest',
temperature: 0.7,
maxTokens: 1000,
},
});
await anthropic.initialize();
const response = await anthropic.complete({
messages: [{ role: 'user', content: 'Hello!' }],
});
// Stream response
for await (const event of anthropic.streamComplete({
messages: [{ role: 'user', content: 'Tell me a story' }],
})) {
if (event.type === 'content') {
process.stdout.write(event.delta?.content || '');
}
}
Load Balancing Strategies
const manager = await createProviderManager({
providers: [...],
loadBalancing: {
enabled: true,
strategy: 'round-robin', // or 'least-loaded', 'latency-based', 'cost-based'
},
});
| Strategy | Description | Best For |
|---|---|---|
round-robin |
Rotate through providers | Even distribution |
least-loaded |
Use provider with lowest load | High throughput |
latency-based |
Use fastest provider | Low latency |
cost-based |
Use cheapest provider | Cost optimization |
Automatic Failover
const manager = await createProviderManager({
providers: [...],
fallback: {
enabled: true,
maxAttempts: 3, // Try up to 3 providers
},
});
// Events for monitoring
manager.on('fallback_success', ({ originalProvider, fallbackProvider, attempts }) => {
console.log(`Fallback from ${originalProvider} to ${fallbackProvider}`);
});
manager.on('fallback_exhausted', ({ originalProvider, attempts }) => {
console.error(`All ${attempts} fallback attempts failed`);
});
Request Caching
const manager = await createProviderManager({
providers: [...],
cache: {
enabled: true,
ttl: 300000, // 5 minutes
maxSize: 1000, // Max cached responses
},
});
// Cache is keyed by: messages + model + temperature + maxTokens
// Identical requests return cached responses
// Clear cache when needed
manager.clearCache();
Cost Optimization
const manager = await createProviderManager({
providers: [...],
costOptimization: {
enabled: true,
maxCostPerRequest: 0.10, // Max $0.10 per request
},
});
// Request with cost constraints
const response = await manager.complete({
messages: [...],
costConstraints: {
maxCost: 0.05,
preferredModels: ['gpt-4o-mini', 'claude-3-haiku-20240307'],
},
});
// Get cost breakdown
console.log('Cost:', {
prompt: response.cost?.promptCost,
completion: response.cost?.completionCost,
total: response.cost?.totalCost,
currency: response.cost?.currency,
});
Tool Calling
const response = await manager.complete({
messages: [
{ role: 'user', content: 'What is the weather in San Francisco?' }
],
tools: [
{
type: 'function',
function: {
name: 'get_weather',
description: 'Get weather for a location',
parameters: {
type: 'object',
properties: {
location: { type: 'string', description: 'City name' },
unit: { type: 'string', enum: ['celsius', 'fahrenheit'] },
},
required: ['location'],
},
},
},
],
toolChoice: 'auto',
});
// Check for tool calls
if (response.toolCalls) {
for (const call of response.toolCalls) {
console.log('Tool:', call.function.name);
console.log('Args:', JSON.parse(call.function.arguments));
}
}
Streaming
// Async iterator streaming
for await (const event of manager.streamComplete(request)) {
switch (event.type) {
case 'content':
process.stdout.write(event.delta?.content || '');
break;
case 'tool_call':
console.log('Tool call:', event.delta?.toolCall);
break;
case 'error':
console.error('Error:', event.error);
break;
case 'done':
console.log('\nUsage:', event.usage);
console.log('Cost:', event.cost);
break;
}
}
Multimodal (Vision/Audio)
// Image input (OpenAI, Anthropic, Google)
const response = await manager.complete({
messages: [
{
role: 'user',
content: [
{ type: 'text', text: 'What is in this image?' },
{ type: 'image', imageUrl: 'https://example.com/image.jpg' },
// or imageBase64: 'base64-encoded-image'
],
},
],
});
TypeScript Types
import type {
// Provider types
LLMProvider,
LLMModel,
LLMProviderConfig,
ILLMProvider,
ProviderCapabilities,
// Message types
LLMMessage,
LLMContentPart,
LLMToolCall,
LLMTool,
// Request/Response
LLMRequest,
LLMResponse,
LLMStreamEvent,
// Manager types
ProviderManagerConfig,
LoadBalancingStrategy,
// Status types
HealthCheckResult,
ProviderStatus,
CostEstimate,
UsageStats,
// Error types
LLMProviderError,
RateLimitError,
AuthenticationError,
ModelNotFoundError,
ProviderUnavailableError,
} from '@claude-flow/providers';
Error Handling
import {
LLMProviderError,
RateLimitError,
AuthenticationError,
isLLMProviderError,
isRateLimitError,
} from '@claude-flow/providers';
try {
const response = await manager.complete(request);
} catch (error) {
if (isRateLimitError(error)) {
console.log(`Rate limited. Retry after: ${error.retryAfter}ms`);
} else if (isLLMProviderError(error)) {
console.log(`Provider error: ${error.code}`);
console.log(`Retryable: ${error.retryable}`);
}
}
Error Types
| Error | Code | HTTP | Retryable |
|---|---|---|---|
RateLimitError |
RATE_LIMIT |
429 | Yes |
AuthenticationError |
AUTHENTICATION |
401 | No |
ModelNotFoundError |
MODEL_NOT_FOUND |
404 | No |
ProviderUnavailableError |
PROVIDER_UNAVAILABLE |
503 | Yes |
Environment Variables
# API Keys
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
GOOGLE_API_KEY=...
COHERE_API_KEY=...
# Ollama (local)
OLLAMA_BASE_URL=http://localhost:11434
# Optional overrides
ANTHROPIC_BASE_URL=https://api.anthropic.com
OPENAI_BASE_URL=https://api.openai.com/v1
Provider Configuration
Anthropic
{
provider: 'anthropic',
apiKey: process.env.ANTHROPIC_API_KEY!,
model: 'claude-3-5-sonnet-latest',
temperature: 0.7,
maxTokens: 4096,
timeout: 60000,
retryAttempts: 3,
}
OpenAI
{
provider: 'openai',
apiKey: process.env.OPENAI_API_KEY!,
model: 'gpt-4o',
temperature: 0.7,
maxTokens: 4096,
frequencyPenalty: 0,
presencePenalty: 0,
}
{
provider: 'google',
apiKey: process.env.GOOGLE_API_KEY!,
model: 'gemini-1.5-pro',
temperature: 0.7,
maxTokens: 8192,
topK: 40,
}
Cohere
{
provider: 'cohere',
apiKey: process.env.COHERE_API_KEY!,
model: 'command-r-plus',
temperature: 0.7,
maxTokens: 4000,
}
Ollama (Local)
{
provider: 'ollama',
apiUrl: 'http://localhost:11434',
model: 'llama3.2',
temperature: 0.7,
maxTokens: 4096,
}
Performance
| Metric | Target |
|---|---|
| Provider initialization | <500ms |
| Request routing | <5ms |
| Cache lookup | <1ms |
| Health check | <2s |
Integration with Claude Flow
import { createProviderManager } from '@claude-flow/providers';
import { createUnifiedSwarmCoordinator } from '@claude-flow/swarm';
// Create provider manager
const providers = await createProviderManager({
providers: [
{ provider: 'anthropic', apiKey: '...', model: 'claude-3-5-sonnet-latest' },
{ provider: 'openai', apiKey: '...', model: 'gpt-4o' },
],
loadBalancing: { enabled: true, strategy: 'cost-based' },
});
// Use with swarm coordinator
const coordinator = createUnifiedSwarmCoordinator({
// Agents can use provider manager for LLM calls
extensions: {
providers,
},
});
Related Packages
- @claude-flow/embeddings - Embedding generation
- @claude-flow/memory - Vector storage and retrieval
- @claude-flow/swarm - Multi-agent coordination
- @claude-flow/neural - SONA learning integration
License
MIT