scorpiox-openai ai-provider

Translates Anthropic Claude API requests into OpenAI-compatible format, allowing tools that speak the OpenAI protocol to use Claude models seamlessly.

linux-x64 linux-arm64 macos-arm64 windows-x64

⚙️ Flags & Options

This tool has no user-facing flags. It is configured via environment variables and invoked internally by the ScorpioX provider system.

🏗️ Architecture

OpenAI Client
chat/completions
scorpiox-openai
format translator
Anthropic API
messages endpoint

The proxy intercepts OpenAI-formatted requests (including streaming via SSE), translates message structures, tool definitions, and system prompts into Anthropic's native format, then converts responses back. This enables any tool built for the OpenAI API — including Codex CLI, Cursor, Continue, and other editors — to use Claude models without code changes.

💻 Usage Examples

Start the proxy as a local server
$ scorpiox-openai
# Listening on 127.0.0.1:18020
# Translating OpenAI → Anthropic Claude API
Point an OpenAI-compatible client at the proxy
$ export OPENAI_API_BASE=http://127.0.0.1:18020/v1
$ export OPENAI_API_KEY=sk-ant-xxxxx # Your Anthropic API key
$ curl http://127.0.0.1:18020/v1/chat/completions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{"model":"claude-sonnet-4-20250514","messages":[{"role":"user","content":"Hello"}]}'
# Response in OpenAI format:
{"id":"msg_...","object":"chat.completion","choices":[...]}
Use with Codex CLI (OpenAI's coding agent)
$ export OPENAI_BASE_URL=http://127.0.0.1:18020/v1
$ codex "Refactor this module to use async/await"
# Codex CLI sends OpenAI requests → scorpiox-openai → Claude
Streaming mode with Server-Sent Events
$ curl -N http://127.0.0.1:18020/v1/chat/completions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{"model":"claude-sonnet-4-20250514","stream":true,"messages":[{"role":"user","content":"Explain TCP"}]}'
# data: {"id":"...","object":"chat.completion.chunk","choices":[{"delta":{"content":"TCP is..."}}]}
# data: [DONE]
Use with Python OpenAI SDK
# pip install openai
import openai

client = openai.OpenAI(
    base_url="http://127.0.0.1:18020/v1",
    api_key="sk-ant-xxxxx",
)

response = client.chat.completions.create(
    model="claude-sonnet-4-20250514",
    messages=[{"role": "user", "content": "Write a Makefile"}],
)
print(response.choices[0].message.content)
Tool/function calling through the proxy
$ curl http://127.0.0.1:18020/v1/chat/completions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{"model":"claude-sonnet-4-20250514","messages":[{"role":"user","content":"What is the weather in Tokyo?"}],"tools":[{"type":"function","function":{"name":"get_weather","parameters":{"type":"object","properties":{"city":{"type":"string"}}}}}]}'
# Returns tool_calls in OpenAI format, translated from Claude's tool_use

📦 Source & Build Info

Source File
scorpiox/scorpiox-openai.c
Lines of Code
1,293
Dependencies
libcurl, libsxhttp, libsxutil, yyjson