{"id":50439947,"url":"https://github.com/harryplusplus/primal-codex","last_synced_at":"2026-05-31T18:31:12.375Z","repository":{"id":358300434,"uuid":"1240809999","full_name":"harryplusplus/primal-codex","owner":"harryplusplus","description":null,"archived":false,"fork":false,"pushed_at":"2026-05-16T17:39:28.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-16T18:43:10.204Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/harryplusplus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-16T15:44:35.000Z","updated_at":"2026-05-16T17:39:32.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/harryplusplus/primal-codex","commit_stats":null,"previous_names":["harryplusplus/primal-codex"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/harryplusplus/primal-codex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryplusplus%2Fprimal-codex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryplusplus%2Fprimal-codex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryplusplus%2Fprimal-codex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryplusplus%2Fprimal-codex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harryplusplus","download_url":"https://codeload.github.com/harryplusplus/primal-codex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harryplusplus%2Fprimal-codex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33744444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-31T18:31:11.699Z","updated_at":"2026-05-31T18:31:12.369Z","avatar_url":"https://github.com/harryplusplus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Primal Codex\n\nEnables Codex to work with the OpenAI Chat Completions API (`/chat/completions`).\n\n## 목적\n\nCodex 클라이언트(CLI, TUI, Desktop app)와 OpenAI compatible API를 제공하는 오픈소스 모델 클라우드 제공자를 연동하기 위한 리버스 프록시 서버입니다.\nCodex에서 이제는 [OpenAI Chat Completions](https://developers.openai.com/api/reference/chat-completions/overview)를 지원하지 않습니다.\n오직 [OpenAI Responses API](https://developers.openai.com/api/reference/responses/overview)만 지원합니다.\n그래서 Codex와 오픈소스 모델 클라우드 제공자를 연동하기 위해서는 Responses API를 OpenAI compatible API로 변환하는 계층이 필요합니다.\n이 프로젝트는 그 변환 계층을 담당합니다.\n\n## 설계\n\n### 구성 파일\n\n구성 파일의 경로는 환경변수 `PRIMAL_CODEX_HOME`가 빈 값이 아니라면 `$PRIMAL_CODEX_HOME/config.toml`, \n빈 값이라면 `~/.primal-codex/config.toml`입니다.\n\n구성 파일은 TOML 포맷입니다. \n멀티 제공자를 지원하기 위해서 제공자는 여러개 등록될 수 있습니다.\nCodex 클라이언트로 전달되는 모델 `slug`값은 `\u003cprovider_id\u003e/\u003cmodel_id\u003e`입니다.\n\n아래 블록은 Crof 제공자의 GLM-5.1 Precision 모델을 사용하는 예제입니다.\n이 경우 Codex 클라이언트는 `crof/glm-5.1-precision`이라는 모델 정보를 받습니다.\n\n```toml\n[server]\nhost = \"127.0.0.1\"\nport = 8010\n\n[providers.crof]\nbase_url = \"https://crof.ai/v1\"\nenv_key = \"CROF_API_KEY\"\n\n[providers.crof.models.\"glm-5.1-precision\"]\nsupported_reasoning_levels = [{effort=\"medium\"}, {effort=\"high\"}]\ninput_modalities = [\"text\"]\n```\n\n### 명령어\n\n#### 구성 파일 초기화\n\n`primal-codex init` 명령어를 사용해 빈 구성파일을 생성합니다.\n빈 구성파일에는 주석을 uncomment하거나 보고 작성할 수 있도록 충분한 정보를 제공해야 합니다.\n\n#### Codex 설정 업데이트\n\n`primal-codex codex` 명령어를 사용해 Codex 설정을 업데이트합니다.\n\n`CODEX_HOME` 환경변수가 빈 값이 아니라면 `$CODEX_HOME/config.toml`을 읽습니다.\n빈 값이라면 `~/.codex/config.toml`을 읽습니다.\n\n`model_catalog_json`값이 있다면 지웁니다. 이 설정이 없어야 Codex 클라이언트가 Primal Codex 서버의 /models 엔드포인트에서 모델 목록을 조회합니다.\n`model_provider`값을 `primal-codex`로 설정합니다.\n`model_providers.primal-codex.name`을 `primal-codex`로 설정합니다. 필수 프로퍼티입니다.\n`model_providers.primal-codex.base_url`을 `http://\u003cconfig.server.host\u003e:\u003cconfig.server.port\u003e`로 설정합니다.\n\n변경 사항이 있다면, 기존 파일을 `\u003cpath\u003e.bak`으로 백업한 후 신규 파일을 씁니다.\n\n#### 서버 실행\n\n`primal-codex serve` 명령어를 사용해 Primal Codex 서버를 실행합니다.\n\n### 서버 API\n\n\u003e `base_url` = `http://\u003cserver.host\u003e:\u003cserver.port\u003e`.\n\u003e `\u003cserver.host\u003e`, `\u003cserver.port\u003e`는 설정 파일의 `[server]` 섹션 값을 따릅니다.\n\n#### 모델 목록 조회\n\n```\nCodex 클라이언트 -\u003e GET /models -\u003e 로드된 구성 파일 내용을 기반으로 모델 목록 반환\n```\n\n구성 파일은 멀티 제공자 목록을 지원하기 때문에 Codex로 모델 목록을 내려줄 때,\n모델의 slug를 `\u003cprovider_id\u003e/\u003cmodel_id\u003e` 형태로 전달합니다.\n\n구성 파일에 모델의 정의되지 않은 필드들은 서버가 적절히 기본값을 전달합니다.\nPrimal Codex의 구성 파일 -\u003e 서버에서 일부 조건에 따라서 기본값을 설정 -\u003e Codex 클라이언트에서 API 요청의 응답에 기본값을 채움.\n이 순서로 모델 정보의 값이 채워집니다.\n어떤 필드를 구성할 수 있는지는 Primal Codex 구성 파일의 주석을 확인해주세요.\n\n어떤 모델 정보가 Codex로 전달되는지 확인을 원하는 경우, 아래 API를 호출하세요.\n\n```bash\ncurl \u003cbase_url\u003e/models\n```\n\n#### LLM 요청\n\n```\nCodex 클라이언트 \u003c-\u003e Responses API (SSE /responses) \u003c-\u003e Primal Codex 서버 \u003c-\u003e OpenAI compatible API (SSE /chat/completions)\n```\n\nResponses API 요청을 Chat Completions 요청으로 변환해 제공자로 전달합니다.\nCodex가 준 모델 slug는 `\u003cprovider_id\u003e/\u003cmodel_id\u003e`로 분해해 올바른 제공자의 API를 호출합니다.\n\n#### OpenAPI\n\nAPI의 스펙을 확인하고 싶으실 경우, 아래 API를 호출하세요.\n\n```bash\ncurl \u003cbase_url\u003e/openapi.json\n```\n\n## 개발 환경\n\n- `uv` 패키지 매니저\n- Python 3.11\n- codex 레퍼런스 소스 코드\n```sh\ngit submodule update --init --recursive\n```\n- `codex` CLI\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryplusplus%2Fprimal-codex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharryplusplus%2Fprimal-codex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryplusplus%2Fprimal-codex/lists"}