Skip to content

AI key rotation

Free and low-cost model tiers enforce strict per-minute and per-day quotas. A single key can work for a while and then return 429 Too Many Requests, run out of credits, or time out in the middle of a task. Switching tools or waiting for a reset breaks the workflow.

VdevAI’s automatic key hopping (AUTO-HOP) keeps an ordered pool of your keys. When a key is unavailable, it moves to the next healthy key instead of ending the task at the first error.

  • It does not bypass a provider’s quota or create free inference.
  • It does not share keys between machines or users.
  • It does not guarantee that every provider has capacity at the same moment.
  • It does not silently mix two different model responses inside one streamed answer.

You still need valid keys and providers with available capacity. Rotation turns several imperfect keys into one more resilient chain.

  1. Open VdevAI → Settings → AI Key Rotation.
  2. Add a key for Groq, Gemini, OpenRouter, DeepSeek, GitHub Models, OpenAI, or a custom OpenAI-compatible endpoint.
  3. Give it a label, choose a model, and select Save & test.
  4. Drag the rows to set the order. The top key is tried first.
  5. Enable Ollama if you want a local model at the end of the chain.

The current free tier does not impose a key cap. “Unlimited” means unlimited keys in the client; your providers still apply their own limits.

Event VdevAI behavior
429, quota exhausted, timeout, transient 5xx Put the key on cooldown, try the next healthy key
Failure before the response streams Continue the task on the next key
Failure after streaming starts Retry the turn with the next key; do not splice two answers together
Every key cooling down Retry the key whose cooldown expires soonest
Request too large for a provider’s TPM limit (413) Trim the request for that provider, or move on; do not bench the key

Default cooldowns are 60 seconds for a 429 and 15 seconds for a transient failure. A key that keeps failing stays out of rotation until its cooldown expires.

The provider list in Settings is the source of truth for the current build. Common options include:

  • Groq
  • Google Gemini
  • OpenRouter
  • DeepSeek
  • GitHub Models
  • OpenAI
  • Custom OpenAI-compatible endpoints
  • Ollama

A custom endpoint supplies its own base URL and model. Ollama uses http://localhost:11434/v1 by default.

BYOK keys are stored locally in VS Code SecretStorage, backed by the operating system keychain where available. They are not sent to the webview. Requests go directly from the extension to your selected provider.

The optional VdevAI Cloud path is different: hosted requests go to api.vdevai.com and then to the model provider. Cloud does not need your personal provider keys.

If a hosted Cloud budget reaches zero, the API returns a byok fallback signal. The extension can continue on your local key chain or Ollama when one is configured. Without a local chain, the hosted request cannot continue until the budget resets or the plan changes.

Symptom What to check
All keys cooling down Wait for the soonest cooldown, add another provider, or enable Ollama
A key tests as invalid Re-paste it; remove stray whitespace or smart quotes
413 or prompt-too-large The provider’s TPM limit is lower than the request; rotation trims or tries the next key
Model not available Use Save & test to resolve a retired model id, or choose another model
Hosted request stops at $0 Add BYOK keys/Ollama for fallback, or upgrade the Cloud plan