← Back to Skills Marketplace
theshadowrose

Ai Provider Bridge

by Shadow Rose · GitHub ↗ · v1.0.3 · MIT-0
cross-platform ✓ Security Clean
335
Downloads
0
Stars
0
Active Installs
4
Versions
Install in OpenClaw
/install ai-provider-bridge
Description
One interface to call 6 AI providers. Swap models with a config change, not a code rewrite. Zero external dependencies.
README (SKILL.md)

AI Provider Bridge — Unified API for Anthropic/OpenAI/Google/xAI/Mistral/Ollama

One interface to call 6 AI providers. Swap models with a config change, not a code rewrite. Zero external dependencies.


Unified interface for 6 AI providers. One function call, any model.

Supported Providers

Provider Models API Key Env Var
Anthropic Claude Opus, Sonnet, Haiku ANTHROPIC_API_KEY
OpenAI GPT-4o, GPT-4, GPT-3.5 OPENAI_API_KEY
Google Gemini Pro, Gemini Flash GOOGLE_API_KEY
xAI Grok XAI_API_KEY
Mistral Mistral Large, Medium, Small MISTRAL_API_KEY
Ollama Any local model None (local)

Usage

const { AIBridge } = require('./src/ai-bridge');

const ai = new AIBridge({
  currentModel: 'anthropic/claude-sonnet-4-20250514',
  anthropicApiKey: process.env.ANTHROPIC_API_KEY,  // only needed for Anthropic models
  openaiApiKey:    process.env.OPENAI_API_KEY,      // only needed for OpenAI models
  googleApiKey:    process.env.GOOGLE_API_KEY,      // only needed for Google models
  xaiApiKey:       process.env.XAI_API_KEY,         // only needed for xAI models
  mistralApiKey:   process.env.MISTRAL_API_KEY,     // only needed for Mistral models
  ollamaHost:      'http://127.0.0.1:11434'         // optional, default shown
});

const response = await ai.sendMessage('What is the capital of France?');
console.log(response);

Switching Providers

Change the model — provider is inferred from the prefix:

// Switch from cloud to local Ollama
ai.setModel('ollama/llama3.1:8b');

// Same interface
const response = await ai.sendMessage('Same question, free model');

Model prefix → provider mapping:

  • anthropic/ → Anthropic API
  • openai/ → OpenAI API
  • google/ → Google Gemini API
  • xai/ → xAI Grok API
  • mistral/ → Mistral API
  • ollama/ → Local Ollama (no API key needed)

Zero Dependencies

Uses only Node.js built-in https and http modules. No npm install needed.

Changelog

v1.0.3

  • Fixed API usage examples — config object uses camelCase property names (anthropicApiKey, openaiApiKey, googleApiKey, xaiApiKey, mistralApiKey), not flat apiKey or env var names. Model prefix determines provider (anthropic/model-name). Clarified sendMessage() as the correct method name.

v1.0.2

  • Removed require('./token-compressor') reference entirely. TokenCompressor is now an inlined no-op pass-through class — no missing dependency, no external file needed. To enable compression, install the companion token-compressor skill and swap the class as noted in the code comments.
  • Removed automatic "Do not store or train on this data." appended to system prompts in OpenAI-compatible requests. This is the caller's responsibility — pass it via setSystemPrompt() if needed.

v1.0.1

  • TokenCompressor dependency made optional — no-op fallback added when ./token-compressor is not present. Bridge works without it; messages pass through uncompressed.
  • Removed buildSystemPrompt() and workspaceContext option. These allowed embedding workspace files into system prompts sent to external APIs — data exposure risk. Use setSystemPrompt() directly.
  • Added env: section to frontmatter declaring required API keys per provider. All optional — only keys for providers you use are needed.

⚠️ Disclaimer

This software is provided "AS IS", without warranty of any kind, express or implied.

USE AT YOUR OWN RISK.

  • The author(s) are NOT liable for any damages, losses, or consequences arising from the use or misuse of this software — including but not limited to financial loss, data loss, security breaches, business interruption, or any indirect/consequential damages.
  • This software does NOT constitute financial, legal, trading, or professional advice.
  • Users are solely responsible for evaluating whether this software is suitable for their use case, environment, and risk tolerance.
  • No guarantee is made regarding accuracy, reliability, completeness, or fitness for any particular purpose.
  • The author(s) are not responsible for how third parties use, modify, or distribute this software after purchase.

By downloading, installing, or using this software, you acknowledge that you have read this disclaimer and agree to use the software entirely at your own risk.

DATA DISCLAIMER: This software processes and stores data locally on your system. The author(s) are not responsible for data loss, corruption, or unauthorized access resulting from software bugs, system failures, or user error. Always maintain independent backups of important data. This software does not transmit data externally unless explicitly configured by the user.


Support & Links

🐛 Bug Reports [email protected]
Ko-fi ko-fi.com/theshadowrose
🛒 Gumroad shadowyrose.gumroad.com
🐦 Twitter @TheShadowyRose
🐙 GitHub github.com/TheShadowRose
🧠 PromptBase promptbase.com/profile/shadowrose

Built with OpenClaw — thank you for making this possible.


🛠️ Need something custom? Custom OpenClaw agents & skills starting at $500. If you can describe it, I can build it. → Hire me on Fiverr

Usage Guidance
This skill appears to do what it says: it routes chat requests to the declared cloud APIs or a local Ollama instance. Before installing, consider the following: - Only provide API keys for providers you intend to use; granting keys gives the code the ability to send your prompts and history to those cloud services. - The bridge will include conversation history and any system prompt you set in requests to external APIs — that may expose sensitive data. Review where you set system prompts and what you include in history. - The source uses only Node built-ins (http/https) and the hosts it calls are the expected provider endpoints (api.openai.com, api.anthropic.com, generativelanguage.googleapis.com, api.x.ai, api.mistral.ai) and the configured Ollama host. If you plan to use Ollama, keep the host pointed at a local instance (default 127.0.0.1) and avoid pointing it at unknown remote servers. - The SKILL.md had a prompt-injection pattern flag; that appears to be a conservative scanner match. If you are risk-sensitive, open and review SKILL.md and src/ai-bridge.js fully (particularly any remaining code after the truncated portion) to ensure there are no hidden endpoints or surprising behaviors (e.g., arbitrary URLs built from untrusted input). - If you need higher assurance, run the code in an isolated environment, inspect network traffic on first use, and avoid storing provider keys in plain text where other software can read them.
Capability Analysis
Type: OpenClaw Skill Name: ai-provider-bridge Version: 1.0.3 The skill provides a unified interface for multiple AI providers (Anthropic, OpenAI, Google, xAI, Mistral, and Ollama) using only Node.js built-in modules. The code in `src/ai-bridge.js` correctly routes requests to official API endpoints and handles API keys as expected for its stated purpose. The author demonstrates security awareness in the changelog by noting the removal of features that previously posed data exposure risks.
Capability Assessment
Purpose & Capability
Name/description (unified interface for multiple AI providers) matches the code and SKILL.md: the implementation routes requests to Anthropic, OpenAI, Google, xAI, Mistral, or a local Ollama instance. Requesting API keys for those providers is expected and proportional.
Instruction Scope
SKILL.md documents optional env vars and usage examples that map process.env values into the bridge's config. The bridge itself expects API keys passed in the config object (this.config.*) and will throw if you attempt to use a provider without configuring its key. The skill sends conversation history and an optional system prompt to external APIs — this is expected for a chat bridge but is a privacy/data-exposure consideration you should accept consciously.
Install Mechanism
No install spec is present; the package contains only source and docs and uses Node's built-in http/https modules. There is no download-from-URL or third-party dependency installation in the manifest.
Credentials
SKILL.md declares multiple provider API keys as optional env vars, which is appropriate for this multi-provider bridge. Registry metadata lists no required env vars — not a security issue, but a minor mismatch: API keys are optional unless you plan to call that provider. The code uses config properties rather than implicitly reading process.env, so supplying keys via constructor is required for cloud providers.
Persistence & Privilege
The skill is not always-enabled and does not request elevated platform privileges. It does not attempt to modify other skills or system settings. It does make outbound HTTPS/HTTP requests to known provider hostnames and to a configurable Ollama host.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install ai-provider-bridge
  3. After installation, invoke the skill by name or use /ai-provider-bridge
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.3
v1.0.3 Fixed API usage examples — config object uses camelCase property names (anthropicApiKey, openaiApiKey, googleApiKey, xaiApiKey, mistralApiKey), not flat apiKey or env var names. Model prefix determines provider (anthropic/model-name). Clarified sendMessage() as the correct method name. v1.0.2 Removed require('./token-compressor') reference entirely. TokenCompressor is now an inlined no-op pass-through class — no missing dependency, no external file needed. To enable compression, install the companion token-compressor skill and swap the class as noted in the code comments. Removed automatic "Do not store or train on this data." appended to system prompts in OpenAI-compatible requests. This is the caller's responsibility — pass it via setSystemPrompt() if needed. v1.0.1 TokenCompressor dependency made optional — no-op fallback added when ./token-compressor is not present. Bridge works without it; messages pass through uncompressed. Removed buildSystemPrompt() and workspaceContext option. These allowed embedding workspace files into system prompts sent to external APIs — data exposure risk. Use setSystemPrompt() directly. Added env: section to frontmatter declaring required API keys per provider. All optional — only keys for providers you use are needed.
v1.0.2
v1.0.2 Removes all token-compressor external dependency and clarifies system prompt responsibility. v1.0.1 - TokenCompressor dependency made optional — no-op fallback added when ./token-compressor is not present. Bridge now works without it; messages pass through uncompressed. Resolves missing dependency crash on install. - Removed buildSystemPrompt() and workspaceContext option. These allowed embedding workspace files (SOUL.md, USER.md, AGENTS.md) into system prompts sent to external APIs — a data exposure risk. Use setSystemPrompt() directly if a system prompt is needed. - Added env: section to frontmatter declaring required API keys per provider (ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY, XAI_API_KEY, MISTRAL_API_KEY). All are optional — only the providers you use need keys. v1.0.0 Official Launch
v1.0.1
v1.0.1 - TokenCompressor dependency made optional — no-op fallback added when ./token-compressor is not present. Bridge now works without it; messages pass through uncompressed. Resolves missing dependency crash on install. - Removed buildSystemPrompt() and workspaceContext option. These allowed embedding workspace files (SOUL.md, USER.md, AGENTS.md) into system prompts sent to external APIs — a data exposure risk. Use setSystemPrompt() directly if a system prompt is needed. - Added env: section to frontmatter declaring required API keys per provider (ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_API_KEY, XAI_API_KEY, MISTRAL_API_KEY). All are optional — only the providers you use need keys.
v1.0.0
ai-provider-bridge v1.0.0 - Initial release. - Provides a unified API for six AI providers: Anthropic, OpenAI, Google, xAI, Mistral, and Ollama. - Allows switching providers and models by changing configuration, without code changes. - No external dependencies; uses only Node.js built-in http/https modules. - Supports a variety of popular models from each provider, including local models via Ollama.
Metadata
Slug ai-provider-bridge
Version 1.0.3
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 4
Frequently Asked Questions

What is Ai Provider Bridge?

One interface to call 6 AI providers. Swap models with a config change, not a code rewrite. Zero external dependencies. It is an AI Agent Skill for Claude Code / OpenClaw, with 335 downloads so far.

How do I install Ai Provider Bridge?

Run "/install ai-provider-bridge" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Ai Provider Bridge free?

Yes, Ai Provider Bridge is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Ai Provider Bridge support?

Ai Provider Bridge is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Ai Provider Bridge?

It is built and maintained by Shadow Rose (@theshadowrose); the current version is v1.0.3.

💬 Comments