{"id":50813976,"url":"https://github.com/emanuelcasco/ocgo","last_synced_at":"2026-06-13T07:33:47.315Z","repository":{"id":355790815,"uuid":"1229613796","full_name":"emanuelcasco/ocgo","owner":"emanuelcasco","description":"OCGO Provides an Ollama-style CLI for running Claude Code through an OpenCode Go subscription via a local Anthropic-compatible proxy.","archived":false,"fork":false,"pushed_at":"2026-05-27T00:21:52.000Z","size":47,"stargazers_count":22,"open_issues_count":0,"forks_count":5,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-27T02:19:30.771Z","etag":null,"topics":["ai","ai-agents","ollama","ollama-interface","opencode","opencode-go"],"latest_commit_sha":null,"homepage":"","language":"Go","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/emanuelcasco.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":null,"dco":null,"cla":null}},"created_at":"2026-05-05T08:08:40.000Z","updated_at":"2026-05-27T00:21:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/emanuelcasco/ocgo","commit_stats":null,"previous_names":["emanuelcasco/ocgo"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/emanuelcasco/ocgo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelcasco%2Focgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelcasco%2Focgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelcasco%2Focgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelcasco%2Focgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emanuelcasco","download_url":"https://codeload.github.com/emanuelcasco/ocgo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelcasco%2Focgo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34276501,"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-06-13T02:00:06.617Z","response_time":62,"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":["ai","ai-agents","ollama","ollama-interface","opencode","opencode-go"],"created_at":"2026-06-13T07:33:45.976Z","updated_at":"2026-06-13T07:33:47.283Z","avatar_url":"https://github.com/emanuelcasco.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eocgo\u003c/h1\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/emanuelcasco/ocgo/releases\"\u003e\n    \u003cimg alt=\"GitHub release\" src=\"https://img.shields.io/github/v/release/emanuelcasco/ocgo?color=blue\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/emanuelcasco/ocgo/releases\"\u003e\n    \u003cimg alt=\"GitHub downloads\" src=\"https://img.shields.io/github/downloads/emanuelcasco/ocgo/total\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/emanuelcasco/ocgo/blob/main/LICENSE\"\u003e\n    \u003cimg alt=\"GitHub license\" src=\"https://img.shields.io/github/license/emanuelcasco/ocgo\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://go.dev/doc/go1.22\"\u003e\n    \u003cimg alt=\"Go version\" src=\"https://img.shields.io/github/go-mod/go-version/emanuelcasco/ocgo\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\n\u003cdiv align=\"center\"\u003e\n \u003cimg alt=\"Logo\" src=\"assets/ocgo-logo.svg\"\u003e\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/emanuelcasco/ocgo\"\u003eocgo\u003c/a\u003e is a small Go CLI for using your OpenCode Go subscription from Claude Code or Codex CLI in one command — no manual proxy setup required.\n  \u003cbr/\u003e\n  \u003cbr/\u003e\n  🤖 \u003cem\u003eClaude Code support.\u003c/em\u003e  🧠 \u003cem\u003eCodex CLI support.\u003c/em\u003e ⚡ \u003cem\u003eLocal compatibility proxy.\u003c/em\u003e\n\u003c/div\u003e\n\n## Why `ocgo`?\n\n`ocgo` is a small Go CLI that lets [Claude Code](https://docs.anthropic.com/en/docs/claude-code) and [Codex CLI](https://developers.openai.com/codex/cli/) run against an OpenCode Go subscription. It starts a local compatibility proxy, translates Claude Code's Anthropic Messages API requests when needed, exposes OpenAI-compatible endpoints for Codex, and launches tools with the right configuration.\n\n```bash\n# 1. Setup your OpenCode API key\nocgo setup\n\n# 2. Start coding!\nocgo launch claude --model kimi-k2.6\nocgo launch codex --model kimi-k2.6\n```\n\nUse your OpenCode Go subscription from Claude Code or Codex CLI in one command — no manual proxy setup required.\n\n## Features\n\n- Save and reuse your OpenCode Go API key.\n- List known OpenCode Go model IDs.\n- Run Claude Code through OpenCode Go with one command.\n- Run Codex CLI through OpenCode Go with one command.\n- Map Claude Code or Codex model names to OpenCode Go models when you want transparent model routing.\n- Start, stop, and inspect a local proxy server.\n- Exposes Anthropic-compatible and OpenAI-compatible local API layers.\n- Supports streaming text responses and basic tool-call translation.\n\n## Requirements\n\n- Go 1.22 or newer.\n- A valid OpenCode Go API key.\n- Claude Code or Codex CLI installed and available.\n\n## Installation\n\nInstall with Homebrew:\n\n```bash\nbrew install emanuelcasco/tap/ocgo\n```\n\nOr tap the repository first:\n\n```bash\nbrew tap emanuelcasco/tap\nbrew install ocgo\n```\n\nBuild from source:\n\n```bash\ngit clone https://github.com/emanuelcasco/ocgo.git\ncd ocgo\nmake install\n```\n\n## Configuration\n\nRun setup and paste your OpenCode Go API key when prompted:\n\n```bash\nocgo setup\n```\n\nOr pass the key directly:\n\n```bash\nocgo setup --api-key sk-opencode-your-key\n```\n\nConfiguration is saved to:\n\n```text\n~/.config/ocgo/config.json\n```\n\nYou can also provide the key at runtime with an environment variable:\n\n```bash\nexport OCGO_API_KEY=sk-opencode-your-key\n```\n\nBy default, the local proxy listens on `127.0.0.1:3456`.\n\n## Usage\n\n### List available models\n\n```bash\nocgo list\n```\n\nAliases are also available:\n\n```bash\nocgo ls\nocgo models\n```\n\n### Map tool models to OpenCode Go models\n\n`ocgo` can route model names used by Claude Code or Codex to OpenCode Go models. Mappings are empty by default; add only the routes you want. The mapping is stored in:\n\n```text\n~/.config/ocgo/model-mapping.json\n```\n\nShow the current mapping for a tool:\n\n```bash\nocgo mapping claude show\nocgo mapping codex show\n```\n\nGet, set, or remove one mapping:\n\n```bash\nocgo mapping claude get claude-sonnet-4-5\nocgo mapping claude set claude-sonnet-4-5 kimi-k2.6\nocgo mapping claude unset claude-sonnet-4-5\nocgo mapping codex set gpt-5 deepseek-v4-pro\nocgo mapping codex rm gpt-5\n```\n\nOpen the mapping file in `$EDITOR`:\n\n```bash\nocgo mapping claude open\nocgo mapping codex open\n```\n\nExact mappings take precedence. For Claude, family mappings such as `claude-sonnet` can also match versioned names such as `claude-sonnet-4-5` when no exact entry exists.\n\n#### Claude mapping\n\nClaude Code primarily shows Claude/Anthropic models in its `/model` picker. It can show a single custom model in some launch modes, but `ocgo` cannot reliably inject the full OpenCode Go model catalog into Claude Code's picker.\n\nFor Claude Code, mappings are useful to make Claude's usual aliases or model names resolve to the OpenCode Go models you prefer, without switching models every session:\n\n```bash\nocgo mapping claude set claude-sonnet kimi-k2.6\nocgo mapping claude set claude-opus deepseek-v4-pro\nocgo mapping claude show\n```\n\nWith the `claude-sonnet` family mapping above, requests for versioned Sonnet names also route to the same target unless an exact mapping exists:\n\n```text\nclaude-sonnet-4-5 -\u003e kimi-k2.6\n```\n\nWhen launching Claude, `ocgo` prints the active mapping and exports Claude's default model environment variables only for configured routes.\n\n#### Codex mapping\n\nCodex is different: `ocgo` can already provide a model catalog to Codex through `~/.codex/ocgo-models.json`, so OpenCode Go models can appear directly in Codex's model selection UI.\n\nFor Codex, mappings are mostly useful for compatibility with prompts, scripts, tools, or existing config that still request original Codex/OpenAI model names. For example:\n\n```bash\nocgo mapping codex set gpt-5.5 deepseek-v4-pro\n```\n\nThen a request for `gpt-5.5` is routed to `deepseek-v4-pro`. Mapped aliases are also included in the generated Codex model catalog so they can appear alongside OpenCode Go model IDs.\n\n### Launch Claude Code\n\nStart Claude Code through the local proxy:\n\n```bash\nocgo launch claude\n```\n\nUse a specific OpenCode Go model:\n\n```bash\nocgo launch claude --model kimi-k2.6\n```\n\nPass arguments through to Claude Code after `--`:\n\n```bash\nocgo launch claude --model kimi-k2.6 -- -p \"How does this repository work?\"\n```\n\nAllow Claude Code to skip permission prompts:\n\n```bash\nocgo launch claude --yes\n```\n\nWhen `ocgo launch claude` starts Claude Code, it sets:\n\n```bash\nANTHROPIC_BASE_URL=http://127.0.0.1:3456\nANTHROPIC_AUTH_TOKEN=unused\n```\n\nWhen `--model` is provided, it also sets:\n\n```bash\nANTHROPIC_MODEL=\u003cmodel\u003e\nANTHROPIC_SMALL_FAST_MODEL=\u003cmodel\u003e\n```\n\nIf Claude Code requests a Claude model name, `ocgo` routes the request through `ocgo mapping claude`. Unmapped model names pass through unchanged. `ocgo launch claude` prints the active mapping before starting Claude Code.\n\n### Launch Codex CLI\n\nStart Codex CLI through the local proxy:\n\n```bash\nocgo launch codex\n```\n\nUse a specific OpenCode Go model:\n\n```bash\nocgo launch codex --model kimi-k2.6\n```\n\nPass arguments through to Codex after `--`:\n\n```bash\nocgo launch codex --model kimi-k2.6 -- --sandbox workspace-write\n```\n\nConfigure Codex without launching it:\n\n```bash\nocgo launch codex --config\n```\n\nWhen `ocgo launch codex` runs, it writes or updates the `ocgo-launch` Codex profile. For newer Codex versions it writes `~/.codex/ocgo-launch.config.toml`; for compatibility with older Codex versions it also writes legacy profile sections in `~/.codex/config.toml`:\n\n```toml\n[profiles.ocgo-launch]\nopenai_base_url = \"http://127.0.0.1:3456/v1/\"\nforced_login_method = \"api\"\nmodel_provider = \"ocgo-launch\"\nmodel_catalog_json = \"/Users/you/.codex/ocgo-models.json\"\n\n[model_providers.ocgo-launch]\nname = \"OpenCode Go\"\nbase_url = \"http://127.0.0.1:3456/v1/\"\nwire_api = \"responses\"\n```\n\nIt then launches:\n\n```bash\ncodex --profile ocgo-launch -m \u003cmodel\u003e\n```\n\nThe Codex process receives `OPENAI_API_KEY=ocgo`; the local proxy injects your real OpenCode Go API key upstream. `ocgo` also writes `~/.codex/ocgo-models.json` so Codex has metadata for OpenCode Go model IDs such as `deepseek-v4-pro`.\n\nCodex model names can be routed through `ocgo mapping codex`. Mapped Codex aliases are included in the generated `~/.codex/ocgo-models.json` catalog so they can appear alongside OpenCode Go models.\n\n## Proxy commands\n\nRun the proxy in the foreground:\n\n```bash\nocgo serve\n```\n\nRun it in the background:\n\n```bash\nocgo serve --background\n# or\nocgo serve -b\n```\n\nCheck whether the proxy is running:\n\n```bash\nocgo status\n```\n\nStop the background proxy:\n\n```bash\nocgo stop\n```\n\nProxy runtime files are stored in:\n\n```text\n~/.config/ocgo/ocgo.pid\n~/.config/ocgo/ocgo.log\n```\n\n## Development\n\n### Set up a local development environment\n\nClone the repository and enter the project directory:\n\n```bash\ngit clone \u003crepository-url\u003e\ncd ocgo-cc\n```\n\nInstall Go 1.22 or newer, then download dependencies:\n\n```bash\ngo mod download\n```\n\nBuild the binary:\n\n```bash\nmake build\n```\n\nThe binary is written to:\n\n```text\nbin/ocgo\n```\n\nOptionally install it to `~/go/bin`:\n\n```bash\nmake install\n```\n\nMake sure the install location is in your `PATH`:\n\n```bash\nexport PATH=\"$HOME/go/bin:$PATH\"\n```\n\nConfigure an OpenCode Go API key for local testing:\n\n```bash\nbin/ocgo setup\n# or, if installed:\nocgo setup\n```\n\nRun the CLI without building:\n\n```bash\nmake run\n```\n\nRun tests:\n\n```bash\nmake test\n```\n\nRemove built binaries:\n\n```bash\nmake clean\n```\n\n## Release\n\nThis project includes a plain Bash release script, no GoReleaser required. It uses the GitHub CLI to create the GitHub release and update a Homebrew tap formula.\n\nRequirements:\n\n```bash\nbrew install gh\ngh auth login\n```\n\nRelease a new version:\n\n```bash\nmake release TAG=v0.1.0\n```\n\nBy default, releases are published to `emanuelcasco/ocgo` and the Homebrew formula is pushed to `emanuelcasco/homebrew-tap`. You can override those with `GITHUB_REPOSITORY=owner/repo` and `HOMEBREW_TAP_REPO=owner/homebrew-tap`.\n\nThe script builds macOS/Linux `amd64` and `arm64` archives, uploads them to GitHub Releases, and commits `Formula/ocgo.rb` to the tap repo.\n\n## How it works\n\n`ocgo` exposes a local compatibility API used by Claude Code and Codex CLI:\n\n- `GET /health`\n- `POST /v1/messages`\n- `POST /v1/messages/count_tokens`\n- `POST /v1/chat/completions`\n- `POST /v1/responses`\n\nRequests sent to `/v1/messages` are converted from Anthropic Messages format into OpenAI-compatible chat completion requests.\n\nRequests sent to `/v1/chat/completions` are passed through as OpenAI-compatible chat completion requests while `ocgo` injects the configured OpenCode Go API key.\n\nRequests sent to `/v1/responses` use a lightweight OpenAI Responses API adapter for Codex CLI. The adapter converts common Responses input, tool definitions, and streaming text events to and from chat completions.\n\nAll upstream requests are forwarded to:\n\n```text\nhttps://opencode.ai/zen/go/v1/chat/completions\n```\n\nClaude Code responses are converted back into Anthropic-compatible responses. Codex responses are returned in OpenAI-compatible Chat Completions or Responses API shapes depending on the requested endpoint.\n\n## Limitations\n\n`ocgo` is intentionally lightweight. Token counting currently returns `0`, and Anthropic/OpenAI compatibility is focused on the request and response shapes needed by Claude Code and Codex CLI rather than full API parity. The `/v1/responses` adapter is minimal and targets text/tool workflows used by Codex; it is not a complete OpenAI Responses API implementation.\n\n## License\n\nMIT. See [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femanuelcasco%2Focgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femanuelcasco%2Focgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femanuelcasco%2Focgo/lists"}