Skip to content

Commit 2c53ff3

Browse files
lidge-junclaude
andcommitted
feat(docs): brand logo + Korean & Chinese localization
- Logo: use the provided mark. Generated transparent light (black) + dark (white) variants so it stays visible on both Starlight themes, plus a rounded favicon.png (replaces the old placeholder favicon.svg). Wired via Starlight `logo`/`favicon`. - i18n: add Korean (/ko) and Simplified Chinese (/zh-cn) locales with a fully translated sidebar; English stays at the root. Adds a language switcher. - Translated all 14 pages into ko + zh-cn (28 files) — prose + frontmatter values translated; code, component syntax, product/adapter/field names preserved; internal links localized per locale. Build green: 43 pages, no broken links. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0efaeb7 commit 2c53ff3

33 files changed

Lines changed: 2167 additions & 30 deletions

docs-site/astro.config.mjs

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,58 @@ export default defineConfig({
1313
description:
1414
"Universal provider proxy for OpenAI Codex — use any LLM with Codex CLI, App, and SDK.",
1515
tagline: "Use any LLM with OpenAI Codex.",
16-
favicon: "/favicon.svg",
16+
logo: {
17+
light: "./src/assets/logo-light.png",
18+
dark: "./src/assets/logo-dark.png",
19+
replacesTitle: false,
20+
},
21+
favicon: "/favicon.png",
1722
social: [
1823
{ icon: "github", label: "GitHub", href: "https://github.com/lidge-jun/opencodex" },
1924
],
2025
editLink: {
2126
baseUrl: "https://github.com/lidge-jun/opencodex/edit/main/docs-site/",
2227
},
2328
lastUpdated: true,
29+
// English at the site root; Korean under /ko, Simplified Chinese under /zh-cn.
30+
defaultLocale: "root",
31+
locales: {
32+
root: { label: "English", lang: "en" },
33+
ko: { label: "한국어", lang: "ko" },
34+
"zh-cn": { label: "简体中文", lang: "zh-CN" },
35+
},
2436
sidebar: [
2537
{
2638
label: "Getting Started",
39+
translations: { ko: "시작하기", "zh-CN": "开始使用" },
2740
items: [
28-
{ label: "Installation", slug: "getting-started/installation" },
29-
{ label: "Quickstart", slug: "getting-started/quickstart" },
30-
{ label: "How It Works", slug: "getting-started/how-it-works" },
41+
{ label: "Installation", translations: { ko: "설치", "zh-CN": "安装" }, slug: "getting-started/installation" },
42+
{ label: "Quickstart", translations: { ko: "빠른 시작", "zh-CN": "快速开始" }, slug: "getting-started/quickstart" },
43+
{ label: "How It Works", translations: { ko: "동작 원리", "zh-CN": "工作原理" }, slug: "getting-started/how-it-works" },
3144
],
3245
},
3346
{
3447
label: "Guides",
48+
translations: { ko: "가이드", "zh-CN": "指南" },
3549
items: [
36-
{ label: "Providers", slug: "guides/providers" },
37-
{ label: "Model Routing", slug: "guides/model-routing" },
38-
{ label: "Codex Integration", slug: "guides/codex-integration" },
39-
{ label: "Sidecars: Web Search & Vision", slug: "guides/sidecars" },
40-
{ label: "Web Dashboard", slug: "guides/web-dashboard" },
50+
{ label: "Providers", translations: { ko: "프로바이더", "zh-CN": "提供商" }, slug: "guides/providers" },
51+
{ label: "Model Routing", translations: { ko: "모델 라우팅", "zh-CN": "模型路由" }, slug: "guides/model-routing" },
52+
{ label: "Codex Integration", translations: { ko: "Codex 통합", "zh-CN": "Codex 集成" }, slug: "guides/codex-integration" },
53+
{ label: "Sidecars: Web Search & Vision", translations: { ko: "사이드카: 웹 검색 & 비전", "zh-CN": "边车:网络搜索与视觉" }, slug: "guides/sidecars" },
54+
{ label: "Web Dashboard", translations: { ko: "웹 대시보드", "zh-CN": "网页控制台" }, slug: "guides/web-dashboard" },
4155
],
4256
},
4357
{
4458
label: "Reference",
59+
translations: { ko: "레퍼런스", "zh-CN": "参考" },
4560
items: [
46-
{ label: "CLI", slug: "reference/cli" },
47-
{ label: "Configuration", slug: "reference/configuration" },
48-
{ label: "Adapters", slug: "reference/adapters" },
49-
{ label: "Architecture", slug: "reference/architecture" },
61+
{ label: "CLI", translations: { ko: "CLI", "zh-CN": "命令行" }, slug: "reference/cli" },
62+
{ label: "Configuration", translations: { ko: "설정", "zh-CN": "配置" }, slug: "reference/configuration" },
63+
{ label: "Adapters", translations: { ko: "어댑터", "zh-CN": "适配器" }, slug: "reference/adapters" },
64+
{ label: "Architecture", translations: { ko: "아키텍처", "zh-CN": "架构" }, slug: "reference/architecture" },
5065
],
5166
},
52-
{ label: "Contributing", slug: "contributing" },
67+
{ label: "Contributing", translations: { ko: "기여하기", "zh-CN": "贡献" }, slug: "contributing" },
5368
],
5469
}),
5570
],

docs-site/public/favicon.png

15.7 KB
Loading

docs-site/public/favicon.svg

Lines changed: 0 additions & 16 deletions
This file was deleted.

docs-site/src/assets/logo-dark.png

115 KB
Loading
114 KB
Loading
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: 기여하기
3+
description: opencodex 개발하기 — 설정, 구조, 컨벤션, 그리고 프로바이더나 어댑터를 추가하는 방법.
4+
---
5+
6+
## 설정
7+
8+
```bash
9+
git clone https://github.com/lidge-jun/opencodex.git
10+
cd opencodex
11+
bun install
12+
bun run dev # proxy in dev mode
13+
bun x tsc --noEmit # typecheck (must be clean)
14+
```
15+
16+
웹 대시보드는 별도의 앱입니다:
17+
18+
```bash
19+
cd gui && bun install && bun dev
20+
```
21+
22+
지금 읽고 있는 문서 사이트는 `docs-site/`에 있습니다(Astro + Starlight):
23+
24+
```bash
25+
cd docs-site && bun install && bun dev
26+
```
27+
28+
## 컨벤션
29+
30+
- **ES Modules 전용**(`import`/`export`), TypeScript, `strict` 모드. `bun x tsc --noEmit`을 깨끗하게
31+
유지하세요.
32+
- **파일당 최대 약 500줄** — 책임별로 분할하세요(`web-search/``vision/` 사이드카가 단일
33+
`index.ts` 뒤에 작고 집중된 모듈을 둔 좋은 예입니다).
34+
- **비동기 에러는 경계에서 처리** — 사이드카는 요청 경로로 절대 throw하지 않으며, 우아한 마커로
35+
성능을 낮춥니다.
36+
- **Devlog** — 설계 노트는 10단위 범위 번호를 사용해 `devlog/NN_slug/`에 둡니다(`00–09` 리서치,
37+
`10–19` 1단계, …). 새 작업은 다음 10단위를 받습니다.
38+
- **익스포트 보존** — 다른 모듈이 이에 의존할 수 있습니다.
39+
40+
## 카탈로그에 프로바이더 추가하기
41+
42+
대부분의 프로바이더는 API 키 카탈로그(`src/oauth/key-providers.ts`)의 항목 하나에 불과합니다:
43+
44+
```ts
45+
"my-provider": {
46+
label: "My Provider",
47+
baseUrl: "https://api.example.com/v1",
48+
adapter: "openai-chat",
49+
dashboardUrl: "https://example.com/keys",
50+
models: ["model-a", "model-b"],
51+
defaultModel: "model-a",
52+
noVisionModels: ["model-a"], // text-only models → vision sidecar describes images
53+
}
54+
```
55+
56+
`enrichProviderFromCatalog()``models` / `noVisionModels` / `noReasoningModels`를 생성된
57+
프로바이더 설정으로 복사하므로 분류가 자동으로 적용됩니다. OAuth 프로바이더의 경우 대신
58+
`src/oauth/index.ts``OAUTH_PROVIDERS`에 추가하세요.
59+
60+
## 어댑터 추가하기
61+
62+
`src/adapters/``ProviderAdapter`([어댑터](/opencodex/ko/reference/adapters/) 참조)를 구현하고,
63+
어댑터 리졸버에 등록한 뒤, 그 출력을 내부 `AdapterEvent`로 브리징하세요. 이미지 처리에는
64+
`image.ts`를 재사용하고, 스트리밍 + 툴 호출의 레퍼런스로 `openai-chat.ts`를 따르세요.
65+
66+
## 완료를 주장하기 전에 검증하기
67+
68+
변경 사항을 증명하는 가장 좁은 명령을 실행하세요 — 타입에는 `bun x tsc --noEmit`, 동작에는 집중된
69+
런타임 프로브. opencodex는 큰 배치보다 작고 검증 가능한 커밋을 선호합니다.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: 작동 방식
3+
description: opencodex의 전체 요청 수명 주기 — parse, route, adapt, bridge, stream.
4+
---
5+
6+
import { Steps } from '@astrojs/starlight/components';
7+
8+
Codex는 정확히 하나의 프로토콜만 사용합니다: OpenAI **Responses API**(`POST /v1/responses`, Server-Sent
9+
Events). opencodex는 이 요청을 받아 프로바이더의 wire 포맷으로 변환하고, 스트리밍되는 응답을 다시
10+
Responses 이벤트로 변환합니다 — 그래서 Codex는 자신이 OpenAI와 통신하고 있지 않다는 사실을 전혀 알지 못합니다.
11+
12+
```
13+
┌──────────────────────────── opencodex ────────────────────────────┐
14+
│ │
15+
Codex ──▶ │ parser ──▶ router ──▶ [vision] ──▶ adapter ──▶ provider │ ──▶ Codex
16+
(/v1/ │ │ │ │ │ │ │ (SSE)
17+
responses)│ OcxParsed provider describe buildRequest parseStream │
18+
│ Request +adapter images + fetch AdapterEvent[] │
19+
│ │ │ │
20+
│ [web-search loop] bridge ─▶ SSE │
21+
└─────────────────────────────────────────────────────────────────────┘
22+
```
23+
24+
## 수명 주기
25+
26+
<Steps>
27+
28+
1. **Parse**`responses/parser.ts`가 Zod 스키마(`responses/schema.ts`)로 요청을 검증하고
29+
이를 내부 `OcxParsedRequest`로 변환합니다: 시스템 프롬프트, 정규화된 메시지 목록
30+
(텍스트, 이미지, tool call, tool result), tool 정의, 생성 옵션, 그리고
31+
`_webSearch`(호스팅 웹 검색 요청됨)와 `_structuredOutput`(JSON 스키마 /
32+
JSON-object `text.format`이 설정됨) 같은 기능 플래그. 이미지는 실제 콘텐츠 파트로 보존되며,
33+
절대 base64 텍스트로 인라인되지 않습니다.
34+
35+
2. **Route**`router.ts`가 고정된 우선순위에 따라 요청된 모델 id를 설정된 프로바이더로
36+
매핑합니다: 명시적 `provider/model` → 프로바이더의 `defaultModel` → 프로바이더의 `models[]`
37+
내장 prefix 패턴(`claude-`, `gpt-`, `o1-`/`o3-`/`o4-`, `llama-`/`mixtral-`/`gemma-`) →
38+
`defaultProvider` 폴백. [모델 라우팅](/opencodex/ko/guides/model-routing/)을 참고하세요.
39+
40+
3. **Authenticate**`oauth` 프로바이더의 경우, opencodex가 새로 자동 갱신된 access
41+
토큰을 bearer 키로 교체하므로, 기존 adapter들은 변경 없이 인증됩니다.
42+
43+
4. **Vision sidecar(선택)** — 라우팅된 모델이 `provider.noVisionModels`에 나열되어 있고
44+
요청에 이미지가 포함된 경우, opencodex는 ChatGPT 로그인을 통한 `gpt-5.4-mini` vision 모델로
45+
각 이미지를 설명한 뒤 텍스트로 치환합니다. 덕분에 텍스트 전용 모델도 해당 이미지에 대해 추론할 수 있습니다.
46+
[Sidecar](/opencodex/ko/guides/sidecars/)를 참고하세요.
47+
48+
5. **Passthrough 빠른 경로** — adapter가 패스스루(`forward` 모드의 `openai-responses`,
49+
또는 `azure`)인 경우, 원본 요청 본문이 프로바이더로 그대로 전달되고 응답도 변환 없이
50+
그대로 스트리밍됩니다. 어떤 변환도 일어나지 않습니다.
51+
52+
6. **Web-search sidecar(선택)** — Codex가 호스팅 `web_search`를 활성화했지만 라우팅된 모델이
53+
OpenAI가 아닌 경우, opencodex는 합성 `web_search` function tool을 노출하고 모델을 작은
54+
에이전트 루프로 실행하면서, ChatGPT 로그인을 통한 `gpt-5.4-mini`로 실제 검색을 수행해
55+
그 결과를 tool result로 다시 주입합니다.
56+
57+
7. **Adapt** — 그 외의 경우, 선택된 adapter의 `buildRequest()`가 프로바이더의 네이티브
58+
포맷으로 업스트림 HTTP 요청(URL, 헤더, 본문)을 생성하고, opencodex가 이를 `fetch`합니다.
59+
60+
8. **Bridge** — adapter의 `parseStream()`(또는 `parseResponse()`)이 내부 `AdapterEvent`
61+
생성합니다(텍스트, reasoning, tool-call start/delta/end, done, error). `bridge.ts`는 그 스트림을
62+
다시 Responses SSE 이벤트로 변환합니다 — `response.output_text.delta`, `response.reasoning_summary_text.delta`,
63+
`response.function_call_arguments.delta`, `response.completed` 등 — 그리고 Codex가 이를 소비합니다.
64+
65+
</Steps>
66+
67+
## 왜 Codex 포크가 아니라 프록시인가?
68+
69+
Codex는 Responses API를 하드코딩하고 있습니다. opencodex는 프로토콜 경계에서 변환을 수행함으로써
70+
Codex **CLI, App, SDK**를 변경 없이 그대로 지원하고, Codex 업데이트에도 영향을 받지 않으며,
71+
Codex 자체를 건드리지 않고 요청마다 프로바이더를 전환할 수 있게 합니다. 이 변환은 양방향이며
72+
스트리밍에 충실합니다: reasoning 요약, MCP tool 네임스페이스, freeform(`apply_patch`) tool,
73+
`tool_search` 발견이 모두 정확히 왕복합니다. 이벤트별 매핑은 [아키텍처 레퍼런스](/opencodex/ko/reference/architecture/)
74+
참고하세요.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: 설치
3+
description: opencodex(ocx) 프록시와 사전 요구 사항을 설치하고, 정상 실행되는지 확인합니다.
4+
---
5+
6+
opencodex는 단일 CLI인 `ocx`로 제공됩니다. 작은 로컬 HTTP 서버(Bun 기반)로 실행되며, 설정한
7+
프로바이더 외에는 어디로도 트래픽을 전송하지 않습니다.
8+
9+
## 사전 요구 사항
10+
11+
| 요구 사항 | 이유 |
12+
| --- | --- |
13+
| **[Bun](https://bun.sh) ≥ 1.1**(권장) 또는 **Node ≥ 20** | `ocx`는 Bun 런타임에서 실행되며, 서비스 러너가 `bun`을 호출합니다. |
14+
| **[OpenAI Codex](https://openai.com/codex)**(CLI, App, 또는 SDK) | opencodex가 앞단에 위치하는 클라이언트입니다. opencodex는 `~/.codex/config.toml`에 기록합니다. |
15+
| 프로바이더 계정 또는 API 키 | Anthropic, xAI, Kimi, Ollama Cloud, OpenRouter, OpenAI 호환 엔드포인트, 또는 ChatGPT 로그인. |
16+
17+
## 설치
18+
19+
```bash
20+
# With Bun (recommended)
21+
bun install -g opencodex
22+
23+
# With npm
24+
npm install -g opencodex
25+
```
26+
27+
바이너리가 `PATH`에 있는지 확인합니다:
28+
29+
```bash
30+
ocx --help
31+
```
32+
33+
## 소스에서 실행
34+
35+
opencodex 자체를 직접 수정하며 작업하려면:
36+
37+
```bash
38+
git clone https://github.com/lidge-jun/opencodex.git
39+
cd opencodex
40+
bun install
41+
bun run dev # starts the proxy in dev mode (src/cli.ts start)
42+
```
43+
44+
웹 대시보드는 `gui/`에 있으며 별도로 실행됩니다:
45+
46+
```bash
47+
cd gui && bun install && bun dev
48+
```
49+
50+
## 생성되는 항목
51+
52+
| 경로 | 용도 |
53+
| --- | --- |
54+
| `~/.opencodex/config.json` | 프로바이더, 기본 프로바이더, 포트, 옵션. |
55+
| `~/.opencodex/ocx.pid` | 실행 중인 프록시의 PID(단일 인스턴스 가드). |
56+
| `~/.opencodex/auth.json` | 저장된 OAuth 자격 증명(`ocx login` 시). |
57+
| `~/.opencodex/catalog-backup.json` | 변경 전에 백업해 둔 원본 Codex 모델 카탈로그. |
58+
| `~/.codex/config.toml` | opencodex가 `ocx init` 시 여기에 `[model_providers.opencodex]` 테이블을 추가합니다. |
59+
60+
:::note
61+
opencodex는 절대 Codex 설정을 삭제하지 않습니다. 모든 주입은 되돌릴 수 있습니다 — `ocx stop`, `ocx restore`,
62+
또는 `ocx eject`는 opencodex가 추가한 줄만 정확히 제거하고 네이티브 Codex를 복원합니다.
63+
:::
64+
65+
## 다음
66+
67+
[Quickstart](/opencodex/ko/getting-started/quickstart/)로 이동해 첫 프로바이더를 설정하거나,
68+
아키텍처를 알아보려면 [작동 방식](/opencodex/ko/getting-started/how-it-works/)을 읽어 보세요.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: Quickstart
3+
description: 첫 프로바이더를 설정하고 명령어 세 개로 OpenAI Codex를 opencodex로 라우팅합니다.
4+
---
5+
6+
이 가이드는 새로 설치한 상태에서 OpenAI가 아닌 모델로 Codex를 실행하기까지의 과정을 안내합니다.
7+
8+
## 1. 설정 마법사 실행
9+
10+
```bash
11+
ocx init
12+
```
13+
14+
`ocx init`은 다음 과정을 안내합니다:
15+
16+
1. **프로바이더 선택** — 프리셋(opencode zen, Anthropic, OpenAI, OpenRouter, Groq, Google,
17+
Azure)을 고르거나, `custom`을 선택해 base URL과 adapter를 직접 입력합니다.
18+
2. **API 키** — 키를 붙여넣거나, `${ANTHROPIC_API_KEY}`와 같은 환경 변수를 참조합니다.
19+
3. **기본 모델** — 요청이 다른 프로바이더와 매칭되지 않을 때 사용되는 모델입니다.
20+
4. **프록시 포트** — 기본값은 `10100`입니다.
21+
5. **Codex에 주입할까요?** — 동의하면 opencodex가 `[model_providers.opencodex]` 테이블을
22+
`~/.codex/config.toml`에 기록하고, `model_provider = "opencodex"`로 설정해 Codex가 프록시를 통해 라우팅하도록 합니다.
23+
24+
결과는 `~/.opencodex/config.json`에 저장됩니다.
25+
26+
## 2. 프록시 시작
27+
28+
```bash
29+
ocx start # defaults to port 10100
30+
ocx start --port 8080
31+
```
32+
33+
시작 시 opencodex는:
34+
35+
- PID를 `~/.opencodex/ocx.pid`에 기록하고(두 번 실행되는 것을 거부),
36+
- 각 프로바이더의 실시간 모델 목록을 가져와 **Codex의 모델 카탈로그에 동기화**하며,
37+
- `http://localhost:<port>/v1`에서 수신 대기합니다.
38+
39+
확인:
40+
41+
```bash
42+
ocx status
43+
```
44+
45+
## 3. Codex 사용
46+
47+
이제 Codex는 opencodex와 투명하게 통신합니다:
48+
49+
```bash
50+
codex "Refactor this function for readability"
51+
```
52+
53+
특정 라우팅 모델을 지정하려면, Codex의 모델 선택기에 표시되는 `provider/model` 형식을 사용하세요:
54+
55+
```bash
56+
codex -m "anthropic/claude-opus-4-8" "Explain this stack trace"
57+
codex -m "ollama-cloud/glm-5.2" "Write a SQL migration"
58+
```
59+
60+
## 키를 붙여넣는 대신 로그인하기
61+
62+
일부 프로바이더는 실제 계정 로그인을 지원합니다(OAuth, 자동 갱신):
63+
64+
```bash
65+
ocx login xai # or: anthropic, kimi
66+
ocx logout xai
67+
```
68+
69+
OpenAI 자체는 **키가 필요 없습니다** — 기본 프로바이더가 기존 `codex login`
70+
자격 증명을 그대로 포워딩합니다([프로바이더](/opencodex/ko/guides/providers/) 참고).
71+
72+
## 중지 및 복원
73+
74+
```bash
75+
ocx stop # stop the proxy and restore native Codex
76+
ocx restore # restore native Codex without stopping (alias: ocx eject)
77+
```
78+
79+
## 다음
80+
81+
- [작동 방식](/opencodex/ko/getting-started/how-it-works/) — 각 요청에 무슨 일이 일어나는지.
82+
- [프로바이더](/opencodex/ko/guides/providers/) — 인증하는 모든 방법.
83+
- [구성](/opencodex/ko/reference/configuration/) — 전체 `config.json` 레퍼런스.

0 commit comments

Comments
 (0)