DEV Community

날다람쥐
날다람쥐

Posted on

claude-occ: Use Claude Code with Your Own Provider Gateway

claude-occ: Use Claude Code with Your Own Provider Gateway

I built claude-occ, a local gateway proxy that lets Claude Code route requests through your own providers while keeping the normal claude workflow.

GitHub: https://github.com/flyingsquirrel0419/claude-occ

npm: https://www.npmjs.com/package/claude-occ

If this looks useful, a GitHub star would help the project reach more Claude Code users:

https://github.com/flyingsquirrel0419/claude-occ

What is claude-occ?

claude-occ installs an occ command that runs a local Claude Code-compatible gateway.

Claude Code talks to a local occ daemon through the Anthropic Messages API, and occ routes requests to configured providers such as:

  • Anthropic-compatible APIs
  • OpenAI-compatible APIs
  • OpenRouter
  • Google Gemini API
  • Azure OpenAI
  • local servers like Ollama, vLLM, or LM Studio
  • custom OpenAI-compatible endpoints

The goal is simple:

npm install -g claude-occ
occ init
claude
Enter fullscreen mode Exit fullscreen mode

Why I made it

I liked the idea behind opencodex, but Claude Code has a different integration surface.

opencodex targets Codex and /v1/responses.

claude-occ targets Claude Code and /v1/messages.

Claude Code already speaks the Anthropic Messages API, so a local authenticated gateway can sit between Claude Code and the provider you actually want to use.

What it does

claude-occ can:

  • start a local gateway on 127.0.0.1
  • expose configured models through /v1/models
  • show routed provider models in Claude Code's /model picker
  • route /v1/messages to supported upstream APIs
  • install a Claude launcher shim so claude auto-starts the proxy
  • restore native Claude Code behavior with occ native
  • keep config in ~/.claude-occ/config.json
  • store provider keys directly or as environment-variable references

Example model IDs look like this:

openrouter/anthropic/claude-sonnet-5
umans/umans-coder
local/llama3
Enter fullscreen mode Exit fullscreen mode

Important security boundary

Claude Code subscription OAuth stays native-only.

claude-occ does not extract, forward, or reuse Claude Code subscription tokens as upstream credentials.

If you want Claude Code's built-in subscription mode, run:

occ native
Enter fullscreen mode Exit fullscreen mode

That stops the proxy and restores native Claude Code behavior.

Installation

Install from npm:

npm install -g claude-occ
Enter fullscreen mode Exit fullscreen mode

Then run:

occ init
Enter fullscreen mode Exit fullscreen mode

Start Claude Code normally:

claude
Enter fullscreen mode Exit fullscreen mode

The npm package is intentionally small. During install, it detects your OS and CPU architecture, then downloads the matching native occ binary from GitHub Releases.

Supported binaries include Linux, macOS, and Windows for x64 and arm64.

Common commands

occ init
occ start
occ ensure
occ stop
occ restart
occ status
occ health
occ env
occ enable
occ native
occ restore back
occ uninstall
occ provider list
occ provider add openrouter --api-key '${OPENROUTER_API_KEY}' --set-default
occ models
Enter fullscreen mode Exit fullscreen mode

Current limitations

This is a first public release, so some compatibility commands are intentionally lightweight:

  • occ gui currently prints the local dashboard URL.
  • occ service is compatibility-mode behavior, not a full OS service manager.
  • occ sync-cache is a no-op because Claude Code does not expose the same writable model cache pattern as Codex.

I would rather document those limits clearly than pretend everything is finished.

Try it and give feedback

If you use Claude Code and want to route it through your own providers, try it:

npm install -g claude-occ
occ init
claude
Enter fullscreen mode Exit fullscreen mode

GitHub repo:

https://github.com/flyingsquirrel0419/claude-occ

If the project seems useful, please leave a star. It helps a lot with visibility and makes it easier to find early users who can test providers, report edge cases, and suggest better defaults.

https://github.com/flyingsquirrel0419/claude-occ

Feedback, issues, and provider compatibility reports are welcome.

Top comments (0)