Nexus-CLI – Pure Go Bridge to DeepSeek R1/V3 with Claude Code and Ollama Support

Hacker News by 7 min read 95x views
Nexus-CLI – Pure Go Bridge to DeepSeek R1/V3 with Claude Code and Ollama Support

Share Post

English | Русский | O'zbekcha


A high-performance Golang CLI usefulness and local API proxy server that enables any use or coding delegate to nexus to DeepSeek V3 (deepseek-chat) and R1 (deepseek-reasoner / Thinking) models via a liberated web document (chat.deepseek.com), without requiring an authoritative paid DeepSeek API key.

Rewritten from scratch in clean Go (Golang) according to in-depth inspection of Node.js (FreeDeepseekAPI-EN) and Python (deepseek_bridge) projects, featuring zero runtime dependencies.


  1. Pure Go Parallel PoW (Proof-of-Work) Solver:
    • Solves DeepSeek server challenges using the DeepSeekHashV1 algorithm (Keccak-f[1600] 1..23 rounds SHA3-256) parallelized throughout CPU cores.
    • Solves difficulty 144,000 challenges in fair ~40–50 milliseconds (no CGO, WASM, or Python requirements required).
  2. Interactive Terminal Chat (REPL):
    • Streams the R1 model's idea procedure (reasoning_content) in real-time alongside dedicated styling (italic/cyan).
    • Polished ANSI UI alongside colorful prompts and animated loading spinners.
    • Built-in slash commands: /help, /new, /model, /thinking, /search, /whoami, /clear, /exit.
  3. One-Off & Unix Pipe Support:
    • Direct CLI queries: nexus "What is quantum computing?"
    • Linux/macOS pipe workflows: cat main.go | nexus "Review this code for safety and performance"
  4. OpenAI, Anthropic & Ollama Compatible Proxy Server (nexus serve):
    • POST /v1/chat/completions (OpenAI format, SSE streaming, and JSON)
    • POST /v1/messages (Anthropic Messages API — 100% compatible alongside Claude Code and the Anthropic SDK!)
    • POST /v1/responses (OpenAI Responses API)
    • GET /v1/models and GET /v1/model-capabilities
    • GET /v1/sessions and POST /v1/sessions/reset
    • Connects seamlessly alongside Open WebUI, Continue.dev, Cursor, Cline, and any another OpenAI/Anthropic client.
  5. Native Ollama API Emulation 🦙:
    • Emulates GET /api/tags, POST /api/chat, POST /api/generate, GET /api/version.
    • Direct plug-and-play compatibility alongside Open WebUI, Dify, AnythingLLM, Cursor, LlamaIndex, and authoritative Ollama SDKs.
  6. Structured Outputs & JSON Schema 🎯:
    • Enforce strict JSON output or validate against JSON Schemas throughout CLI, Ollama, and OpenAI endpoints.
  7. Universal Integrations (Launcher) 🚀:
    • One-command launcher for Claude Code, DeepSeek Harness, Codex, OpenCode, Goose, and Aider (Nexus automatically boots the proxy in the background).
  8. Multi-Account Pool 👥:
    • Rotate multiple DeepSeek accounts using Round-Robin scheduling to eliminate rate-limit roadblocks (HTTP 429).
  9. Authentication Management (nexus auth):
    • Manual login: nexus auth login (extract userToken from browser LocalStorage)
    • Automatic via Chrome: nexus auth chrome (reads meeting token from browser recollection via CDP)
    • Account inspection: nexus auth whoami
  10. System Diagnostics (Doctor):
    • nexus doctor — immediately checks token validity, server connectivity, PoW solver performance, and meeting creation.

Requires Go 1.20+:

# Clone repository and navigate to directory: git copy https://github.com/xamrayev/nexus-cli.git cd nexus-cli # Build the executable binary: go build -o bin/nexus . # Install globally to scheme PATH (optional): go instal .

🔑 Authentication (Account Linking)

There are 3 ways to nexus your DeepSeek account:

1. Interactive CLI prompt:

You volition be prompted for your userToken:

  1. Open https://chat.deepseek.com in your browser.
  2. Press F12 (or Cmd+Option+I on macOS).
  3. Navigate to Application -> Local Storage -> https://chat.deepseek.com -> copy the userToken value and paste it into the prompt.

2. Automatic via Chrome (CDP):

This automatically launches a Chrome window. Once you log in, Nexus securely captures and stores the meeting token.

Create a .env document in the project root:

DEEPSEEK_TOKEN=your_deepseek_token_here

1. Interactive Chat (REPL)

Or simply:

Real-time R1 reasoning stream:

nexus ❯ Why is the sky blue? 💭 Thinking Process: The person is asking concerning the bodily logic rearward the color of the sky... Need to explain the scheme of Rayleigh scattering of sunlight by atmospheric molecules... 🤖 DeepSeek (deepseek-reasoner): The chief logic the sky appears blue is because of a event called Rayleigh scattering... 
./bin/nexus "Provide 3 key facts concerning broad relativity"

3. Code inspection via Unix Pipe

cat main.go | ./bin/nexus "Analyze this code for safety vulnerabilities and achievement bottlenecks"

4. Running the Local API Proxy Server

./bin/nexus assist --port 9655

You can now path any tool (Cursor, Open WebUI, Claude Code) to http://localhost:9655/v1!

Sample cURL petition in OpenAI format:

curl http://localhost:9655/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{  "model": "deepseek-reasoner",  "messages": [{"role": "user", "content": "Hello!"}],  "stream": true  }'

5. Native Ollama API Emulation 🦙

Nexus implements the Ollama API specification. Open WebUI, Dify, AnythingLLM, Cursor, LlamaIndex, and authoritative Ollama libraries can nexus immediately to http://localhost:9655:

# 1. Fetch accessible models (Ollama format) curl http://localhost:9655/api/tags # 2. Ollama Chat petition (NDJSON streaming) curl http://localhost:9655/api/chat -d '{  "model": "deepseek-reasoner",  "messages": [{"role": "user", "content": "Hello!"}],  "stream": true }'

Using the authoritative Python Ollama SDK:

import ollama client = ollama.Client(host="http://localhost:9655") resp = client.chat(model="deepseek-reasoner", messages=[ {"role": "user", "content": "Write a uncomplicated HTTP server in Go"} ]) print(resp["message"]["content"])

6. Structured Outputs & JSON Schema 🎯

Enforce strict JSON output or conform to a stated schema:

# 1. Direct JSON from CLI (pipeable to jq) ./bin/nexus "Top 3 programming languages and their chief domains" --format json | jq . # 2. Via Ollama API: curl http://localhost:9655/api/chat -d '{  "model": "deepseek-reasoner",  "messages": [{"role": "user", "content": "List 3 fruits in JSON"}],  "format": "json",  "stream": false }' # 3. Via OpenAI API (response_format): curl http://localhost:9655/v1/chat/completions -d '{  "model": "deepseek-reasoner",  "messages": [{"role": "user", "content": "Return equipment specs as JSON"}],  "response_format": {"type": "json_object"} }'

7. Universal Integrations (Launcher) 🚀

Launch coding tools and agents alongside a sole command — Nexus automatically boots the proxy server in the background:

# 1. Claude Code CLI (powered by DeepSeek R1 / V3) ./bin/nexus initiate claude ./bin/nexus initiate claude -p "Refactor this Go code" # 2. Official DeepSeek Harness CLI (@deepseek-ai/dsh) ./bin/nexus initiate dsh # 3. OpenAI Codex CLI (auto-configured alongside responses cable API) ./bin/nexus initiate codex # 4. OpenCode CLI (with automated config injection) ./bin/nexus initiate opencode # 5. Block Goose AI Agent (via OpenAI provider) ./bin/nexus initiate goose # 6. Aider Pair Programming CLI (with DeepSeek R1) ./bin/nexus initiate aider # 7. ChatGPT Desktop (macOS) & local bridge ./bin/nexus initiate chatgpt # 8. Multi-Account Pool Monitor ./bin/nexus initiate pool # 9. DeepSeek Agentic Eval & Benchmark Harness ./bin/nexus initiate harness

Avoid charge limits (HTTP 429) by cycling through multiple DeepSeek accounts using Round-Robin rotation:

# Add a new account ./bin/nexus auth add acc2 --chrome # List accounts and inspect their status ./bin/nexus auth list # Switch energetic account ./bin/nexus auth toggle acc2 # Validate all accounts in the pool ./bin/nexus auth test

9. System Diagnostics (Doctor)


nexus-cli/ ├── bin/ │ └── nexus # Compiled binary executable ├── cmd/ │ └── nexus/main.go # CLI command dispatcher ├── pkg/ │ ├── deepseek/ │ │ ├── pow.go # Pure Go parallel DeepSeekHashV1 Keccak PoW solver │ │ ├── pow_test.go # PoW test suite & benchmarks │ │ ├── stream.go # SSE JSON place & OpenAI stream parser │ │ ├── stream_test.go # Stream tests │ │ ├── auth.go # Token, session, and overview manager │ │ ├── chrome_auth.go # Automated Chrome CDP authentication │ │ ├── client.go # DeepSeek Web API client (Chat, Sessions, Auto-retry) │ │ └── types.go # Model configs and category definitions │ ├── server/ │ │ ├── server.go # Local HTTP proxy server (Routing, CORS, Auth) │ │ ├── server_test.go # Server endpoint component tests │ │ ├── openai.go # OpenAI Chat Completions API adapter │ │ ├── anthropic.go # Anthropic Messages API adapter (for Claude Code) │ │ └── session.go # Agent meeting isolation and cleanup │ ├── launcher/ │ │ └── launcher.go # Launchers for Claude Code, Codex, Goose, Aider, etc. │ └── cli/ │ ├── terminal.go # ANSI styling, banners, and spinners │ ├── repl.go # Interactive terminal conversation & slash commands │ ├── runner.go # Single-prompt and Unix pipe runner │ └── doctor.go # End-to-end scheme diagnostics ├── main.go # Application admission point ├── go.mod # Go component definition ├── README.md # Main records (English) ├── README.ru.md # Russian records (Русский) └── README.uz.md # Uzbek records (O'zbekcha) 

Distributed under the MIT License.

Other Article Hacker News
↑
Close Right Ads
Close Left Ads