MCPInstall

opencodex-gateway

Local gateway for Codex Desktop with custom API support, web dashboard, Computer Use engine, and Vision Bridge for text-only models

Installs
223
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/reason-machines/codex-skills --skill opencodex-gateway
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads opencodex-gateway automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

OpenCodex Gateway

Skill by ara.so — Codex Skills collection.

OpenCodex is a zero-config local gateway that enables Codex Desktop to use third-party APIs (OpenAI-compatible endpoints). It features a bilingual web dashboard for model management, a custom Computer Use engine with native macOS control, and Vision Bridge that lets text-only models handle visual tasks by automatically describing screenshots.

Installation

git clone https://github.com/AITabby/opencodex.git
cd opencodex
npm install
npm start

The server starts on http://localhost:8765 and automatically:

  • Patches ~/.codex/config.toml (creates backup)
  • Opens the dashboard in your browser
  • Enables the API gateway

Architecture

OpenCodex sits between Codex Desktop and third-party APIs:

Codex Desktop → OpenCodex Gateway (localhost:8765) → Third-party API
                      ↓
                Vision Bridge (optional)
                Computer Use Engine

Web Dashboard

Access at http://localhost:8765/dashboard

Key Features

  • API Configuration: Set base URL, API key, model names
  • Model Management: Add/remove models, toggle visibility in Codex
  • Language Toggle: Switch between English and Chinese
  • Live Logs: SSE-streamed request/response logs
  • One-Click Actions: Restart Codex, reset to native config

Configuration Flow

  1. Open dashboard
  2. Enter API endpoint (e.g., https://api.openai.com/v1 or https://api.deepseek.com)
  3. Add API key (stored in ~/.codex/config.toml)
  4. Add model names (e.g., gpt-4, deepseek-chat)
  5. Check boxes for models you want visible in Codex
  6. Click "Save Configuration"

Configuration Files

Auto-Generated Config

OpenCodex modifies ~/.codex/config.toml:

[api]
base_url = "http://localhost:8765/v1"
api_key = "your-actual-api-key"

[[models]]
name = "gpt-4"
enabled = true

[[models]]
name = "deepseek-chat"
enabled = true

Original config backed up to ~/.codex/config.toml.backup

Environment Variables

For development or custom deployments:

export OPENCODEX_PORT=8765
export OPENCODEX_API_KEY=sk-your-key-here
export OPENCODEX_BASE_URL=https://api.openai.com/v1

Vision Bridge

Vision Bridge enables text-only models to handle Computer Use tasks by converting screenshots to text descriptions.

How It Works

  1. Codex sends Computer Use request with screenshot
  2. OpenCodex detects text-only model
  3. Screenshot compressed to 1200px with sips
  4. Vision model describes the screenshot
  5. Description injected into the prompt
  6. Text-only model receives modified request

Configuration

In the dashboard, configure Vision Bridge settings:

{
  "vision_bridge": {
    "enabled": true,
    "endpoint": "https://api.openai.com/v1",
    "model": "gpt-4-vision-preview",
    "api_key": "process.env.VISION_API_KEY",
    "max_dimension": 1200
  }
}

Programmatic Example

If extending OpenCodex, here's how Vision Bridge is invoked:

import { VisionBridge } from './vision-bridge';

const bridge = new VisionBridge({
  endpoint: process.env.VISION_ENDPOINT,
  model: 'gpt-4-vision-preview',
  apiKey: process.env.VISION_API_KEY
});

// Automatically converts screenshot to description
const description = await bridge.describeImage(screenshotBase64);
// Injects into prompt for text-only model
const modifiedPrompt = bridge.injectDescription(originalPrompt, description);

Computer Use Engine

OpenCodex implements custom Computer Use actions for macOS using native CGEvent APIs.

Supported Actions

  • Mouse: Click, move, drag, scroll
  • Keyboard: Type text, press keys, shortcuts
  • Window: Focus, resize, minimize
  • Screenshot: Capture and compress

Action Format

Codex sends tool calls in this format:

{
  "type": "computer_use",
  "action": "mouse_click",
  "params": {
    "x": 500,
    "y": 300,
    "button": "left"
  }
}

Example Actions

Mouse Click

{
  "action": "mouse_click",
  "params": { "x": 500, "y": 300, "button": "left" }
}

Type Text

{
  "action": "type_text",
  "params": { "text": "Hello, world!" }
}

Screenshot

{
  "action": "screenshot",
  "params": { "max_dimension": 1200 }
}

Response includes base64 image:

{
  "success": true,
  "image": "iVBORw0KGgoAAAANS..."
}

API Reference

Proxy Endpoint

All OpenAI-compatible requests go through:

POST http://localhost:8765/v1/chat/completions

Headers:

Authorization: Bearer <your-api-key>
Content-Type: application/json

Dashboard API

Get Configuration

curl http://localhost:8765/api/config

Update Configuration

curl -X POST http://localhost:8765/api/config \
  -H "Content-Type: application/json" \
  -d '{
    "base_url": "https://api.deepseek.com",
    "api_key": "sk-...",
    "models": [
      {"name": "deepseek-chat", "enabled": true}
    ]
  }'

Restart Codex

curl -X POST http://localhost:8765/api/restart-codex

Reset to Native

curl -X POST http://localhost:8765/api/reset-native

Live Logs (SSE)

curl -N http://localhost:8765/api/logs

Stream format:

data: {"timestamp": "2026-06-04T10:30:00Z", "level": "info", "message": "Request to gpt-4"}

data: {"timestamp": "2026-06-04T10:30:01Z", "level": "info", "message": "Response 200"}

Common Patterns

Adding Multiple Models

const models = [
  { name: 'gpt-4-turbo', enabled: true },
  { name: 'gpt-4', enabled: true },
  { name: 'claude-3-opus', enabled: false }
];

await fetch('http://localhost:8765/api/config', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ models })
});

Switching Providers

To switch from OpenAI to DeepSeek:

  1. Open dashboard
  2. Change base URL to https://api.deepseek.com
  3. Update API key
  4. Change model name to deepseek-chat
  5. Enable Vision Bridge (DeepSeek is text-only)
  6. Save configuration

Custom Vision Model

Use a different vision model for Vision Bridge:

{
  "vision_bridge": {
    "enabled": true,
    "endpoint": "https://api.anthropic.com/v1",
    "model": "claude-3-opus-20240229",
    "api_key": "process.env.ANTHROPIC_API_KEY"
  }
}

Troubleshooting

Codex Not Connecting

Symptom: Codex shows "API Error" or "Connection Failed"

Solution:

  1. Verify OpenCodex is running: curl http://localhost:8765/health
  2. Check ~/.codex/config.toml has base_url = "http://localhost:8765/v1"
  3. Restart Codex via dashboard or manually
  4. Check logs: http://localhost:8765/dashboard → scroll to logs

Models Not Appearing

Symptom: Added models don't show in Codex

Solution:

  1. Ensure model checkbox is checked in dashboard
  2. Click "Save Configuration"
  3. Restart Codex (one-click button in dashboard)
  4. Verify ~/.codex/config.toml includes the model with enabled = true

Vision Bridge Not Working

Symptom: Text-only model fails on Computer Use tasks

Solution:

  1. Enable Vision Bridge in dashboard
  2. Configure vision model endpoint and API key
  3. Test vision model separately: curl -X POST <vision_endpoint>/chat/completions
  4. Check OpenCodex logs for vision errors
  5. Ensure screenshot compression succeeds: verify sips is available (which sips)

Rate Limiting

Symptom: 429 errors in logs

Solution:

  • OpenCodex passes through rate limits from upstream API
  • Reduce request frequency in Codex
  • Check API provider's rate limits
  • Consider adding retry logic (upstream API responsibility)

Port Already in Use

Symptom: Error: listen EADDRINUSE: address already in use :::8765

Solution:

# Find process on port 8765
lsof -i :8765
# Kill it
kill -9 <PID>
# Or change port
export OPENCODEX_PORT=8766
npm start

Config Corruption

Symptom: Codex behaves unexpectedly after config changes

Solution:

  1. Click "Reset to Native Codex" in dashboard
  2. Restores ~/.codex/config.toml.backup
  3. Restart Codex
  4. Reconfigure OpenCodex carefully

Screenshot Too Large

Symptom: Vision API rejects screenshots

Solution:

  • Default max dimension: 1200px
  • Reduce in Vision Bridge settings:
{ "max_dimension": 800 }
  • Verify compression: check OpenCodex logs for sips output

Development

Project Structure

opencodex/
├── src/
│   ├── server.ts          # Main Express server
│   ├── vision-bridge.ts   # Vision Bridge logic
│   ├── computer-use.ts    # macOS automation
│   └── config.ts          # Config patching
├── public/
│   └── dashboard.html     # Web UI
└── package.json

Running in Dev Mode

npm run dev  # Enables hot-reload

Adding Custom Actions

Extend Computer Use engine:

// src/computer-use.ts
export async function customAction(params: any) {
  // Use node-mac-automation or applescript
  const result = execSync(`osascript -e 'tell application "Finder" to ...'`);
  return { success: true, result: result.toString() };
}

Register in action handler:

case 'custom_action':
  return await customAction(params);

Logging

Add custom logs visible in dashboard:

import { logger } from './logger';

logger.info('Custom event', { data: someData });
logger.error('Something failed', { error });

Integration with OpenCodexBar

For the ultimate experience, pair with OpenCodexBar:

  1. Run OpenCodex gateway: npm start
  2. Clone and compile OpenCodexBar
  3. Launch bar app
  4. Press Option + Space for system-wide voice activation
  5. Enjoy real-time audio VAD and cinematic visualizer

Both projects work independently but are designed to complement each other.

FAQ

What does the opencodex-gateway skill do?

Local gateway for Codex Desktop with custom API support, web dashboard, Computer Use engine, and Vision Bridge for text-only models

How do I install opencodex-gateway?

Run npx skills add https://github.com/reason-machines/codex-skills --skill opencodex-gateway in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/opencodex-gateway/ (personal) or .claude/skills/opencodex-gateway/ (project).

Which AI agents can use opencodex-gateway?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is opencodex-gateway safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains opencodex-gateway?

It is published by reason-machines in reason-machines/codex-skills. It has 223 recorded installs.

More from reason-machines/codex-skills

View all →

academic-research-skills-codex

reason-machines/codex-skills

AI-assisted academic research workflows for literature review, paper writing, peer review, and research pipelines

codexplusplus-launcher

reason-machines/codex-skills

Enhanced launcher for Codex App that unlocks plugins, enables session deletion, exports conversations, and syncs provider sessions via CDP injection

Security286 installs

codex-plugin-claude-code

reason-machines/codex-skills

Use OpenAI Codex from inside Claude Code for code reviews, adversarial reviews, and delegating tasks to Codex as a subagent.

AI & Agents277 installs

codex-plusplus-tweak-system

reason-machines/codex-skills

Expert in developing, installing, and managing tweaks for the Codex++ desktop app extension system

274 installs

awesome-codex-skills-curator

reason-machines/codex-skills

Curate, install, and manage Codex skills from the awesome-codex-skills collection for AI coding agents.

274 installs

awesome-codex-subagents

reason-machines/codex-skills

A curated collection of 136+ specialized Codex subagents for development tasks across 10 categories

AI & Agents273 installs

Popular backend & apis skills

View category →

find-skills

vercel-labs/skills

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

OfficialBackend & APIs4.1M installs

entra-app-registration

microsoft/azure-skills

Guides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.

OfficialBackend & APIs566.7K installs

This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management" — in a project that needs ADK (Agent Development Kit) API patterns and code examples. It provides a quick reference for agent types, tool definitions, orchestration patterns, callbacks, state management, the graph Workflow API, and reference recipes to study. Do NOT use for scaffolding (use google-agents-cli-scaffold) or deployment (use google-agents-cli-deploy).

Backend & APIs514.8K installs

embedded-captions

heygen-com/hyperframes

Add captions or subtitles to an existing single-subject talking-head video without editing the footage. Use for plain verbatim captions, cinematic captions embedded behind the subject, VFX captions, “炸/特效/酷炫字幕,” or a named identity from the 35-style catalog. Route by visual identity, not by backend engine. The quiet anchor rail is the default; embed every word only when the user explicitly wants a fully cinematic treatment. The workflow runs locally end to end, including transcription and subject matting; split multi-shot footage before applying it.

Backend & APIs453.3K installs

entra-agent-id

microsoft/azure-skills

Provision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmipath, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmipath token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registration (use entra-app-registration), Microsoft Foundry agent authoring (use microsoft-foundry).

OfficialBackend & APIs336.6K installs

neon

neondatabase/agent-skills

Overview of Neon, a complete set of cloud backend primitives around Lakebase Postgres: Auth, Object Storage, Functions, the AI Gateway, and Realtime. Start here to choose Neon for undecided login, files, APIs, and LLM calls, set up the CLI or MCP server, and follow the branch-first workflow. Use when building an app or backend on Neon, or when "Neon" or "Lakebase Postgres" is mentioned. Child skill neon-postgres wins for an existing DATABASEURL, SQL, schema, inspect, or search. Child skill neon-auth wins for login, users, sessions, identity routing, and Managed Better Auth setup. Child skill neon-realtime wins for live queries in reactive apps and agents. Also use for object storage, S3, buckets, serverless functions, function triggers, cron, AI gateway, LLM calls, realtime, logs, Loki, Grafana, observability, postgres, database, backend, Claimable Neon, neon.new, or a no-signup database.

Backend & APIs237.1K installs