← Discover MCPs and Agents
a
MCPAI & MLGitHub

ai-cli-gateway

Local OpenAI Responses-compatible gateway for Codex CLI, Claude Code, and Gemini CLI. Build cross-platform AI MVPs through one endpoint.

Links

README

From the repo.

AI CLI Gateway

npm version npm downloads Node.js CI License

Build AI MVPs with Codex CLI, Claude Code, and Gemini CLI through one local OpenAI Responses-compatible endpoint.

AI CLI Gateway turns locally authenticated AI CLIs into a focused Responses API-compatible subset. It is not a full OpenAI API implementation.

Quick Start

npm install --global ai-cli-gateway
ai-cli-gateway init
ai-cli-gateway serve

The npm launcher requires Node.js >=22.14.0. Install and authenticate at least one supported provider CLI with its own tooling before running init. Guided init creates the configuration, runs readiness checks without inference, and prints the exact client-key and request commands for your system.

The five scoped platform packages are optional internal implementation packages; users install only ai-cli-gateway. npm selects the matching native binary for macOS, Linux, or Windows.

npm package · Getting Started · API and Operations Reference · v0.2.1 release · All releases

From SDK to local CLI

Point an OpenAI JavaScript SDK client at the loopback gateway and use a model alias created during init:

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.AI_CLI_GATEWAY_API_KEY,
  baseURL: "http://127.0.0.1:8080/v1",
  timeout: 300_000,
  maxRetries: 0,
});

const response = await client.responses.create({
  model: "codex-local",
  instructions: "Answer concisely.",
  input: "Propose three names for my AI MVP.",
  text: { format: { type: "text" } },
  stream: false,
  store: false,
  tools: [],
  tool_choice: "none",
});

console.log(response.output_text);

The gateway routes each request through the configured alias to a Codex CLI, Claude Code, or Gemini CLI process, then returns completed text or locally validated JSON. Checked-in JavaScript and Python clients provide runnable examples.

OpenAI SDK or HTTP client
  -> loopback POST /v1/responses
  -> configured model alias
  -> Codex CLI / Claude Code / Gemini CLI
  -> completed text or validated JSON

What it supports

AreaIncluded
ProvidersCodex CLI, Claude Code, and Gemini CLI
PlatformsmacOS Intel and Apple silicon, Linux x86-64 and ARM64, and Windows x86-64
HTTPPOST /v1/responses and GET /v1/models
Inputstring input with optional string instructions
Outputfinal non-streaming text or strict JSON Schema output validated locally
Routingoperator-configured model aliases
Reliabilitybounded queues, timeouts, cancellation, output limits, and process-tree cleanup
Setupguided interactive init, strict flag-only automation, and Doctor diagnostics

This is useful for AI MVPs, product validation, demos, hackathons, structured-output prototypes, and local SDK integrations. It is designed for local or self-hosted use by one trusted OS identity; it has no web UI, database, or conversation store.

Focused compatibility

AI CLI Gateway intentionally does not support:

  • SSE streaming;
  • tool or function-call round trips;
  • stored responses, gateway sessions, or conversation history;
  • multimodal or array input;
  • background execution; or
  • other OpenAI endpoints.

Unsupported fields return a clear 400 unsupported_parameter response instead of being ignored. See the request contract and stable error catalog for the exact boundary.

Security and distribution

  • Provider credentials stay with provider tooling. The gateway never installs a provider CLI, runs provider login, or copies provider credentials.
  • The listener is local. It accepts loopback addresses only and defaults to 127.0.0.1:8080; bearer authentication is optional but recommended when multiple local processes can reach it.
  • Prompts avoid shell interpolation. Provider processes start from argument arrays and receive prompts through stdin.
  • Sensitive content stays out of gateway logs. Prompts, model output, credentials, and raw provider output are not logged.
  • Execution is bounded. Request size, queues, output, runtime, cancellation, and process-tree cleanup have enforced limits.
  • Upstream processing still happens. The selected CLI may send request data to its upstream provider, whose availability, quota, billing, entitlement, and terms still apply.
  • The trust boundary is one OS identity. This is not an isolation boundary between mutually untrusted users sharing an account; use a dedicated service user for shared deployments.

The launcher has no lifecycle downloader and installs one exact host-specific optional dependency. The native executable in each npm package is byte-for-byte identical to its matching GitHub Release archive.

Version 0.2.1 was manually published, and its six npm packages do not expose npm provenance attestations. The repository release workflow is configured to use npm Trusted Publishing for future releases. GitHub build-provenance attestations still cover the five archives, SPDX SBOM, and checksum manifest for v0.2.1.

Read SECURITY.md for private vulnerability reporting and Getting Started for checksum, attestation, update, uninstall, and optional-dependency recovery procedures.

Documentation

NeedRead
Install and send a first requestGetting Started
Check request fields, schemas, errors, providers, and operationsAPI and Operations Reference
Run official SDK examplesJavaScript or Python
Report a vulnerability privatelySecurity Policy
Build, test, or contributeContributing
Review the current releasev0.2.1 release notes
Review guided inithistorical v0.2.0 release notes
Review the original launchhistorical v0.1.0 release notes

AI CLI Gateway is Apache-2.0 licensed. You are responsible for using each provider CLI in accordance with its applicable terms.

Collected info

  • 2 stars
  • Language: Go
  • Source updated: 9/4/2026

Config for your environment

Replace {MCP_ENDPOINT_URL} with this MCP’s endpoint URL (from its repo or docs above). No API key — you connect directly.

Tool

OS

Config file: ~/.cursor/mcp.json

{
  "mcpServers": {
    "mcp-server": {
      "url": "{MCP_ENDPOINT_URL}"
    }
  }
}

Paste into mcpServers in the config file. Restart Cursor after saving.

If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.