Skip to content

Oai Prism

把 OpenAI Prism 折射成标准 API 的 Go 网关:OpenAI Chat / Responses、Anthropic Messages、Codex CLI 开箱即用,多账号池调度与内置管理控制台

Install: git clone https://github.com/alanbulan/oai-prism

Works with Codex · 29 GitHub stars

Install

$git clone https://github.com/alanbulan/oai-prism

Install command taken from the project's README or registry entry. Always review code before running it.

OAIprism

把 OpenAI Prism 折射成你熟悉的标准 API

Go 单二进制网关:OpenAI Chat / Responses、Anthropic Messages、Codex CLI 开箱即用。 多账号池调度,凭据自动续期,内置管理控制台。

快速开始 · 使用指南 · 架构与原理 · 控制台 · 反馈问题

为什么是 OAIprism

Prism(prism.openai.com)背后是强大的推理模型,但它说的是一套私有协议: start + 轮询、turn_state 续令牌、浏览器指纹、Sentinel 反自动化令牌、容器沙箱…… OAIprism 把这些全部收进网关,对外只暴露你已经在用的标准接口 —— 改一个 base_url,现有的 SDK、CLI 和工具链就能直接用上。

快速开始

只需要 Go 1.26+(构建用)。运行时是单个进程、单个端口,不需要 Node.js 或浏览器。 以下命令以 Windows PowerShell 为例,其它平台的启动方式见使用指南。

git clone https://github.com/alanbulan/oai-prism.git
cd oai-prism

# 1. 编译
go build -o oaiprism.exe ./cmd/oaiprism

# 2. 导入账号:粘贴 prism.openai.com 的 Cookie、access token 或 refresh token
.\oaiprism.exe import -stdin -id main

# 3. 启动(只有网关一个进程,监听 8787)
.\tools\start.ps1

启动后打开 http://127.0.0.1:8787/dashboard/,在右上角「API 密钥」生成一个 Key,然后调用:

curl http://127.0.0.1:8787/v1/chat/completions \
  -H "Authorization: Bearer $OAIPRISM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"stream":true,"messages":[{"role":"user","content":"你好"}]}'

不带 model 时用上游当前的默认模型;可用的模型名见 GET /v1/models。

接入客户端

Codex CLI:写入 ~/.codex/config.toml,即可让 Codex 在本地执行、由 Prism 推理。

model_provider = "oaiprism"
model = "gpt-5.6-sol"            # 任选 GET /v1/models 里的名字;上游下架后网关自动改用默认模型
model_context_window = 1000000

[model_providers.oaiprism]
name = "oaiprism"
wire_api = "responses"
requires_openai_auth = false
base_url = "http://127.0.0.1:8787/v1"
experimental_bearer_token = "<你的 Key>"

OpenAI SDK

from openai import OpenAI

client = OpenAI(base_url="http://127.0.0.1:8787/v1", api_key="<你的 Key>")
resp = client.chat.completions.create(
    model="gpt-5.6-sol",
    messages=[{"role": "user", "content": "你好"}],
)
print(resp.choices[0].message.content)

Anthropic SDK

import anthropic

client = anthropic.Anthropic(base_url="http://127.0.0.1:8787", api_key="<你的 Key>")
msg = client.messages.create(
    model="gpt-5.6-sol",  # claude-* 等认不出的名字会换成默认模型
    max_tokens=1024,
    messages=[{"role": "user", "content": "你好"}],
)
print(msg.content[0].text)

可用模型

模型名、展示名和推理档位都跟着上游走,网关不内置任何模型清单:

  • 在售模型取自 Prism 网页模型下拉框的来源(/api/inference/models),按上游的顺序,第一个是默认模型;
  • 推理档位取自 Prism 网页的推理强度选项,每个非默认档位对应一个 <模型>-<档位> 变体(如 gpt-5.6-sol-high), 也可以用请求里的 reasoning_effort / reasoning.effort 指定;
  • 网关启动时拉取,之后每 30 分钟刷新;上游下架的模型(客户端还配着它)自动改用默认模型。

Similar plugs

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

PluginDev tools+6,803 this week

CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies

Documented system prompts from Anthropic - Claude Fable 5.1, Opus 5.5, Claude Design, Claude Code. OpenAI - ChatGPT GPT-6-Astra, Codex. Google - Gemini 3.8 Flash, 3.1 Pro…

Wrap Antigravity, ChatGPT Codex, Claude Code, Grok Build, Muse Code, Devin as an OpenAI/Gemini/Claude/Codex compatible API service, allowing you to enjoy the free Gemini…

Explore related