cd reasoning-agent npm install lms dev # For development with hot reload # OR lms push # To deploy to your LM Studio installation
key1,key2,key3
gemini-3-flash-preview)| Setting | Type | Default | Description |
|---|---|---|---|
| API Keys | string | (required) | Comma-separated Google AI API keys |
| Model Name | string | gemini-3-flash-preview | Gemini model to use |
| Max Tokens | number | 2048 | Maximum response length (100-10000) |
| Temperature | number | 0.7 | Response creativity (0-2) |
| Retry Attempts | number | 3 | Attempts per key before rotation |
| Request Timeout | number | 30000 ms | Timeout per request (1000-120000 ms) |
| Detailed Logging | boolean | false | Enable debug logging |
User: "Use the reasoning tool to analyze the implications of quantum computing on cybersecurity" LM Studio: Calls reasoning_invoke with the prompt Plugin: 1. Sends to Gemini API (key 1) 2. Gets response back 3. Formats as Markdown AI: Returns formatted reasoning to user
User: Asks AI a complex question AI: Calls reasoning_invoke โ Plugin tries key 1 Key 1: Gets 429 quota error Plugin: Automatically rotates to key 2 Key 2: Successfully returns response AI: Uses the reasoning in its answer
reasoning_invoke( prompt="Analyze this...", useThinking=true, temperature=0.3, maxTokens=4096 )
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ AI Calls reasoning_invoke โ โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโ โผ โโโโโโโโโโโโโโโโโโโ โ Key 1: Attempt โ โ Retries: 1-3 โ โโโโโโโโโโฌโโโโโโโโโ โ โโโโโโโโผโโโโโโโ โ Success? โ โ YES โโโ Return Response โ Quota? โ โ โ Auth? โ โ โโโโโโโโฌโโโโโโโ NO โผ โโโโโโโโโโโโโโโโโโโ โ Key 2: Attempt โ โ Retries: 1-3 โ โโโโโโโโโโฌโโโโโโโโโ โ โโโโโโโโผโโโโโโโ โ Success? โ โ YES โโโ Return Response โโโโโโโโฌโโโโโโโ NO โผ โโโโโโโโโโโโโโโโโโโ โ Key 3: Attempt โ โ Retries: 1-3 โ โโโโโโโโโโฌโโโโโโโโโ โ โโโโโโโโผโโโโโโโ โ Success? โ โ YES โโโ Return Response โโโโโโโโฌโโโโโโโ NO โผ Return Error Message (All keys exhausted)
The plugin distinguishes between three error categories:
| Error Type | Trigger | Action |
|---|---|---|
| Quota Error | 429, rate_limit, quota exceeded | Immediately rotate to next key |
| Auth Error | 401, 403, invalid API key | Immediately rotate to next key |
| Transient Error | Network timeout, service unavailable | Retry (up to retryAttempts) |
Enable Detailed Logging in config to see:
[ReasoningAgent] Attempting request with key 1/3 (abc123***) [ReasoningAgent] Using model: gemini-3-flash-preview, temperature: 0.7, maxTokens: 2048 [ReasoningAgent] Attempt 1/3 passed: 429 quota error (Will rotate key) [ReasoningAgent] Attempting request with key 2/3 (def456***) [ReasoningAgent] Successfully generated response (1245 chars)
Check LM Studio's console/logs for these messages while running in dev mode.
Before deploying to production, verify:
curl -X POST https://generativelanguage.googleapis.com/v1beta/models/gemini-3-flash-preview:generateContent?key=YOUR_KEYnpm install in plugin directorynpm run buildreasoning-agent/ โโโ manifest.json # Plugin metadata โโโ package.json # Dependencies & scripts โโโ tsconfig.json # TypeScript compiler config โโโ .gitignore # Git ignore patterns โโโ README.md # This file โโโ src/ โโโ index.ts # Entry point (registers config + tools) โโโ config.ts # Configuration schema for LM Studio UI โโโ toolsProvider.ts # Core implementation (API calls + key rotation)
npm run build
lms dev
lms push
Parameters:
{ prompt: string // Required: The prompt for Gemini systemPrompt?: string // Optional: Custom system prompt useThinking?: boolean // Optional: Enable thinking (default: true) temperature?: number // Optional: Override temperature maxTokens?: number // Optional: Override max tokens }
Returns:
## Reasoning Agent Response [Gemini's response] --- **Model:** gemini-3-flash-preview | **Temperature:** 0.7 | **Max Tokens:** 2048
MIT License - Free for personal and commercial use
Found a bug? Want to improve the plugin?
For issues related to:
Future enhancements:
Version: 1.0.0
Last Updated: April 2026
LM Studio Compatibility: v0.2.28+