Intelligent quota management and model rotation for opencode-antigravity-auth. Automatically switches models when quota runs low, tracks usage across accounts, and works with both OpenCode and oh-my-opencode.
New to the Antigravity ecosystem? Start here:
👉 Complete Installation Guide - Step-by-step setup for auth + quota + oh-my-opencode
Let an LLM set it up:
Set up opencode-antigravity-autopilot for me. Follow:
https://raw.githubusercontent.com/gooseware/opencode-antigravity-autopilot/main/INSTALL.md
Ask me:
1. Am I using oh-my-opencode or vanilla OpenCode?
2. What models do I prefer? (e.g., gemini-3-pro, claude-sonnet-4-5-thinking)
3. Should quota rotation be automatic?
Then configure everything for me.
- opencode-antigravity-auth installed and authenticated
- Node.js >= 20
npm install opencode-antigravity-autopilotAdd to ~/.config/opencode/opencode.json:
{
"plugin": [
"opencode-antigravity-auth@beta",
"opencode-antigravity-autopilot"
]
}Add to ~/.config/opencode/oh-my-opencode.json:
{
"google_auth": false,
"quota_rotation": true,
"agents": {
"Sisyphus": { "model": "google/antigravity-claude-sonnet-4-5" },
"librarian": { "model": "google/antigravity-gemini-3-flash" },
"explore": { "model": "google/antigravity-gemini-3-flash" },
"oracle": { "model": "google/antigravity-claude-opus-4-5-thinking" }
}
}import { QuotaManager } from 'opencode-antigravity-autopilot';
const manager = new QuotaManager({
quotaThreshold: 0.2,
preferredModels: [
'google/antigravity-gemini-3-pro',
'google/antigravity-claude-sonnet-4-5'
]
});
await manager.initialize();
const bestModel = manager.selectBestModel();
console.log(`Using model: ${bestModel}`);
const quota = await manager.getQuota();
console.log(`Remaining quota: ${quota?.remainingFraction * 100}%`);import { createOhMyOpenCodeIntegration, QuotaManager } from 'opencode-antigravity-autopilot';
const manager = new QuotaManager();
await manager.initialize();
const integration = createOhMyOpenCodeIntegration(manager, {
defaultModel: 'google/antigravity-gemini-3-flash'
});
const modelForAgent = await integration.getModelForAgent('oracle');
console.log(`Oracle will use: ${modelForAgent}`);manager.setModelRotationStrategy({
preferredModels: [
'google/antigravity-gemini-3-pro-high',
'google/antigravity-claude-sonnet-4-5-thinking'
],
fallbackModels: [
'google/antigravity-gemini-3-flash',
'google/gemini-2.5-flash'
],
quotaThreshold: 0.15
});- Automatic Model Rotation: Switches to fallback models when quota drops below threshold
- Multi-Account Support: Leverages opencode-antigravity-auth's account pool
- Quota Tracking: Real-time monitoring via LSP process
- oh-my-opencode Compatible: Dynamic agent model assignment
- Zero Config: Works out-of-box with sensible defaults
- Reads authenticated accounts from opencode-antigravity-auth storage
- Monitors quota via Antigravity LSP process (passive monitoring)
- Tracks quota per model and selects best available option
- Auto-rotates accounts when current account is exhausted
- Integrates with oh-my-opencode for agent-level model management
const manager = new QuotaManager(config?: PluginConfig);
await manager.initialize();
manager.getQuota(): Promise<QuotaInfo | null>
manager.selectBestModel(): string | null
manager.rotateAccount(): Promise<void>
manager.updateQuotaForModel(model: string, quota: QuotaInfo): void
manager.setModelRotationStrategy(strategy: ModelRotationStrategy): voidconst integration = createOhMyOpenCodeIntegration(manager, config);
integration.getModelForAgent(agentName: string, preferredModel?: string): Promise<string>
integration.updateAgentConfig(config: OhMyOpenCodeConfig, strategy: ModelRotationStrategy): OhMyOpenCodeConfig
integration.pollQuotaAndRotate(models: string[]): Promise<void>interface PluginConfig {
quotaThreshold?: number; // Default: 0.2 (20%)
pollIntervalMs?: number; // Default: 60000 (1 min)
enableRotation?: boolean; // Default: true
preferredModels?: string[]; // Models to prefer
}LSP Process Not Found
- Ensure Antigravity IDE is running
- Check
ps aux | grep language_server_antigravity
Quota Always Shows Null
- Verify opencode-antigravity-auth is authenticated
- Restart Antigravity IDE
Models Not Rotating
- Check
quotaThresholdsetting - Verify preferred models are configured correctly
Built on opencode-antigravity-auth by @NoeFabris. This plugin extends its authentication system with intelligent quota management.
MIT
Issues and PRs welcome at github.com/gooseware/opencode-antigravity-autopilot