pppp606

CLI Agent OpenAI Adapter — AI skill for Claude Code

AI community

Convert CLI-based AI agents (Claude Code, etc.) to OpenAI ChatAPI endpoints.

How to install CLI Agent OpenAI Adapter

This entry records only its repository, not the path inside it, so there is no exact command to give. Open pppp606/cli-agent-openai-adapter and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What CLI Agent OpenAI Adapter does

Convert CLI-based AI agents (Claude Code, etc.) to OpenAI ChatAPI endpoints.

Alternatives in AI

  • CLI 代理 API — English 中文 一个为 CLI 提供 OpenAI/Gemini/Claude/Codex 兼容 API 接口的代理服务器 19k ★
  • Opencodex — Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama… 12.3k ★
  • Codex — openai-codex Adversarial code review, Codex CLI integration, cross-model analysis 9.6k ★

README

cli-agent-openai-adapter

Convert CLI-based AI agents (Claude Code, etc.) to OpenAI ChatAPI endpoints.

Overview

This adapter allows you to use local CLI tools like Claude Code as drop-in replacements for OpenAI's API in your development environment, while keeping the same code structure for production.

**Use Cases:**

  • Production: Use OpenAI API (pay per token)
  • Development: Use local Claude Code with Haiku model (reduce costs)
  • Same Code: Switch between environments using the same API interface (e.g., LangChain's ChatOpenAI)

**Default Model:** This adapter uses Claude Haiku by default for cost efficiency during development. You can configure a different model (e.g., Sonnet, Opus) via the `MODEL` environment variable.

Features

  • ✅ OpenAI-compatible API endpoints (/v1/chat/completions)
  • ✅ Support for conversation history
  • ✅ Stateless execution (like OpenAI API)
  • ✅ Chat-only mode (tools disabled for safety)
  • ✅ TypeScript with full type definitions
  • 🚧 Claude Code adapter (initial implementation)
  • 🔜 Codex adapter (future)
  • 🔜 Gemini CLI adapter (future)

Demo

Try the adapter with the minimal, dependency-free web client:

# Start the adapter (project root)
npm ci
npm run build && npm start

# Open the client in your browser
# File path: examples/minimal-web-client/index.html

[→ Minimal Web Client README](examples/minimal-web-client/README.md)

Installation

npm install -g cli-agent-openai-adapter

Or use directly with npx:

npx cli-agent-openai-adapter

Prerequisites

  • Node.js >= 20.0.0
  • Claude Code CLI installed and accessible in PATH

To verify Claude Code is installed:

claude --version

Usage

Start the Server

cli-agent-openai-adapter

By default, the server starts at `http://localhost:8000`.

Configuration

Configure using environment variables:

export ADAPTER_TYPE=claude-code  # Adapter to use
export MODEL=haiku                # Cla