Current collected state Current
Observed since 21 Oct, 08:55 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Unified LLM Gateway Library with Google Gemini primary support
Unified LLM Gateway Library with Google Gemini primary support.
npm install @workflow/llm-sdk
import { LLMClient } from '@workflow/llm-sdk';
// Initialize with Gemini only (default)
const client = new LLMClient({
geminiApiKey: process.env.GOOGLE_API_KEY
});
// Simple completion
const response = await client.complete({
prompt: 'Explain quantum computing in simple terms',
complexity: 'simple' // Uses gemini-2.5-flash-lite (2025 default)
});
console.log(response.content);
console.log(`Tokens used: ${response.tokenUsage.total}`);
import { LLMClient } from '@workflow/llm-sdk';
const client = new LLMClient({
// Primary provider (required)
geminiApiKey: process.env.GOOGLE_API_KEY,
// Optional fallback providers
openaiApiKey: process.env.OPENAI_API_KEY,
anthropicApiKey: process.env.ANTHROPIC_API_KEY,
// Default provider preference
defaultProvider: 'gemini', // 'gemini' | 'openai' | 'anthropic'
// Retry configuration
retries: 3,
retryDelays: [2000, 4000, 8000]
});
The library automatically selects the best model based on task complexity:
gemini-2.5-flash-lite (2025 default: fast, low-cost, high-performance)gemini-2.5-pro (2025 default: most powerful with adaptive thinking)// Simple task (uses gemini-2.5-flash-lite - 2025 default)
const simpleResponse = await client.complete({
prompt: 'What is 2+2?',
complexity: 'simple'
});
// Complex task (uses gemini-2.5-pro - 2025 default)
const complexResponse = await client.complete({
prompt: 'Write a comprehensive analysis of quantum computing applications',
complexity: 'complex'
});
const stream = await client.streamComplete({
prompt: 'Tell me a story',
complexity: 'simple'
});
for await (const chunk of stream) {
process.stdout.write(chunk.content);
}
// Count tokens before making a request
const tokens = await client.countTokens('Your prompt here');
console.log(`Estimated tokens: ${tokens}`);
// Check token usage after completion
const response = await client.complete({
prompt: 'Your prompt'
});
console.log(`Input tokens: ${response.tokenUsage.input}`);
console.log(`Output tokens: ${response.tokenUsage.output}`);
console.log(`Total tokens: ${response.tokenUsage.total}`);
try {
const response = await client.complete({
prompt: 'Your prompt'
});
} catch (error) {
if (error.code === 'RATE_LIMIT_EXCEEDED') {
console.error('Rate limit exceeded, try again later');
} else if (error.code === 'PROVIDER_UNAVAILABLE') {
console.error('All providers unavailable');
} else {
console.error('Unexpected error:', error.message);
}
}
# Required
GOOGLE_API_KEY=your_gemini_api_key
# Optional (for fallback)
OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_anthropic_api_key
See API.md for complete API documentation.
MIT
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.0Registry latest | 15 Oct 2025 | 7 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 08:55 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:157c9d9ed09e9efe0016896072ace50f911ecd1f1aed45e5e640a829244fa4fa