Skip to main content
Glama

Why External API?

  • Add Many APIs One by One: Built-in presets for OpenRouter, OpenAI, Groq, DeepSeek, Together AI, Mistral, xAI (Grok), Ollama, LM Studio, and any Custom OpenAI-compatible /v1/chat/completions endpoint — with a Save & add another workflow.

  • Priority Ordering & Drag-and-Drop: Drag rows (or use ↑ / ↓) to sort your providers into #1 Primary, #2 Fallback, #3 Fallback, and toggle any provider On / Off anytime.

  • Automatic Failover: When Auto-switch on failure is enabled, requests automatically fall back down your sorted list of enabled providers if a higher-priority API errors, times out, or hits its budget cap.

  • Usage, Cost & Remaining Budget Stats: Tracks requests, errors, prompt/completion/total tokens, USD spend (using API-reported usage.cost when provided or configurable per-1M token rates), remaining budget, latency, and recent request logs.

  • Native Antigravity MCP App UI: Syncs with Antigravity's theme, host fonts, and light/dark mode tokens across the Sidebar, Side Panel, and Inline Chat views.

  • Zero-Exposure API Key Entry: Enter and update API keys directly inside the External API UI panel (visibility: ["app"] tools) without pasting secrets into chat history. Stored locally in ${PLUGIN_DATA}/registry.json (0600 permissions) and masked in every tool output.

Scope note: Antigravity plugins extend the agent via MCP tools, interactive MCP App panels, and skills. They do not add third-party models to Antigravity's built-in Model Selection dropdown.


Related MCP server: Antigravity Context Card

Installation

Option 1: Install from GitHub (Antigravity CLI)

agy plugin install https://github.com/shrikantdange/external-api-antigravity-plugin

Option 2: Install Locally (Antigravity App / IDE / CLI)

Clone directly into your global Antigravity plugins directory (no npm install or build step needed — prebuilt runtime bundles scripts/server.cjs and ui/dashboard.html are included):

git clone https://github.com/shrikantdange/external-api-antigravity-plugin.git ~/.gemini/config/plugins/external-api

Antigravity discovers ~/.gemini/config/plugins/external-api automatically (Node.js 20+ required, or Antigravity's bundled Node runtime).


Quick Start

  1. Open External API from the Plugins sidebar, the side panel + menu, or ask in chat:

    Open External API to add and manage my AI providers

  2. Click + Add API, choose a preset (e.g., OpenRouter, Groq, DeepSeek, Ollama), enter your API key (optional for local Ollama/LM Studio), and click Fetch models to verify connectivity and pick a default model.

  3. Add additional providers with Save & add another, then drag rows (or use ↑ / ↓) to set your priority order.

  4. Use /external-api or ask Antigravity naturally:

    • "Show my External API usage, cost, and remaining budget"

    • "Ask my configured external AI model to review this function"

    • "List available models on my OpenRouter provider"


Supported Presets & Endpoints

Preset

Default Base URL

API Key

OpenRouter

https://openrouter.ai/api/v1

Required

OpenAI

https://api.openai.com/v1

Required

Groq

https://api.groq.com/openai/v1

Required

DeepSeek

https://api.deepseek.com/v1

Required

Together AI

https://api.together.xyz/v1

Required

Mistral

https://api.mistral.ai/v1

Required

xAI (Grok)

https://api.x.ai/v1

Required

Ollama (Local)

http://localhost:11434/v1

Optional

LM Studio (Local)

http://localhost:1234/v1

Optional

Custom

Any OpenAI-compatible /v1 URL

Optional


MCP Tools Reference

The bundled MCP server (external-api_external-api) exposes:

Model-Callable Tools

Tool

Description

open_dashboard

Opens the External API panel in the side pane (aux_pane) or full-page sidebar (global).

get_usage_stats

Renders current usage, token counts, USD spend, remaining budget, and recent logs inline in chat.

manage_provider

add, update, remove, list, test, reset_stats, or reorder providers and toggle autoFailover.

ask_ai

Sends a prompt to a specific provider or "auto" (priority order with automatic failover across enabled providers).

list_provider_models

Queries a provider's /models endpoint to discover available model IDs.

App-Only Tools (visibility: ["app"])

Used internally by the interactive MCP App UI (ui://external-api/dashboard.html) so API keys typed in the UI never enter LLM chat context:

  • app_get_state, app_save_provider, app_delete_provider, app_test_provider, app_reset_stats, app_reorder_providers, app_set_auto_failover, app_quick_ask.


Security & Privacy

  • API keys are stored locally in ${PLUGIN_DATA}/registry.json with 0600 file permissions (inside a 0700 directory).

  • Raw API keys are never returned in tool text (content) or structuredContent — all outputs return masked keys (e.g., sk-a••••1234).

  • Adding or editing keys via the External API UI panel bypasses LLM conversation history completely.

  • See SECURITY.md for reporting vulnerabilities.


Development & Building from Source

# Install dev/build dependencies
npm install

# Type-check TypeScript sources
npm run typecheck

# Rebuild scripts/server.cjs and ui/dashboard.html
npm run build

# Run end-to-end tests against a local mock OpenAI HTTP server
npm test

# Build and sync directly to ~/.gemini/config/plugins/external-api
npm run sync

Repository Structure

.
├── plugin.json                   # Antigravity plugin manifest
├── mcp_config.json               # Stdio MCP server wiring (${PLUGIN_ROOT} / ${PLUGIN_DATA})
├── assets/logo.svg               # Square SVG plugin icon
├── skills/external-api/SKILL.md  # /external-api skill instructions
├── scripts/server.cjs            # Prebuilt single-file Node.js MCP server
├── ui/dashboard.html             # Prebuilt single-file MCP App UI
├── src/
│   ├── registry.ts               # Provider store, cost/budget accounting & failover router
│   ├── server.ts                 # MCP server & tool/resource definitions
│   ├── ui.ts                     # Interactive MCP App client logic
│   └── styles.css                # Host-themed Antigravity styling
├── build.mjs                     # esbuild bundler for server + single-file HTML UI
└── test_e2e.mjs                  # Automated MCP stdio + mock HTTP end-to-end test suite

Contributing & License

Contributions are welcome — see CONTRIBUTING.md. Licensed under the MIT License.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers