whatisgithub

What is claude-local-api?

shabul/claude-local-api — explained in plain English

Analysis updated 2026-05-18

1PythonAudience · developerComplexity · 2/5Setup · easy

In one sentence

Turns the Claude Code CLI into a local API server your scripts can call, reusing your existing login instead of a separate paid API key.

Mindmap

mindmap
  root((claude-local-api))
    What it does
      Local API server
      Wraps Claude Code CLI
      Uses Unix socket
    Tech stack
      Python
      Unix socket
    Use cases
      Local automation scripts
      Data pipelines
      Concurrent queued requests
    Audience
      Developers
      Automation builders

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add AI capabilities to a local automation script without managing an API key.

USE CASE 2

Run a data processing pipeline that calls Claude for classification or summaries.

USE CASE 3

Batch multiple concurrent requests through a single local queued server.

What is it built with?

PythonUnix socketClaude Code CLI

How does it compare?

shabul/claude-local-apia-bissell/unleash-liteabhiinnovates/whatsapp-hr-assistant
Stars111
LanguagePythonPythonPython
Setup difficultyeasyhardhard
Complexity2/54/53/5
Audiencedeveloperresearcherdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Local-only, the socket cannot be reached over a network, and calls are stateless.

So what is it?

claude-local-api is a tool that turns the Claude Code CLI into a local API server your scripts can talk to, without needing a separate Anthropic API key or dealing with HTTP networking. Instead of making web requests to Anthropic's servers with a paid API key, it reuses the login you already have from the Claude Code CLI and routes requests through a Unix socket, a fast, low-overhead connection method that only works on the same machine. Here is how it works: you run a small Python server that sits in the background and listens on a Unix socket file at /tmp/claude_api.sock. Any script on your machine can then send a prompt to that socket and get back Claude's reply. You paste a single helper function into your script, no package installs needed, just Python's built-in socket and json libraries, call ask_claude with your question, and get a response. You can pick which model tier to use: the fastest lightweight option for simple tasks like classification, a mid-range option for summaries and structured output, or the most capable tier for complex analysis. The server handles multiple requests at the same time by queuing them, so running concurrent tasks in a loop works automatically. You would use this when you want to add AI capabilities to local automation scripts, data processing pipelines, or personal tools, and you want to avoid managing an API key or paying per call beyond your existing subscription. The README notes it is local-only (the socket cannot be reached over a network), calls are stateless with no memory between requests, and the full README is longer than what was provided.

Copy-paste prompts

Prompt 1
Paste the ask_claude helper function into my script and call it to classify this text.
Prompt 2
Set up claude-local-api's server so my script can reach it over the Unix socket.
Prompt 3
Which model tier should I use in claude-local-api for summarizing documents?

Frequently asked questions

What is claude-local-api?

Turns the Claude Code CLI into a local API server your scripts can call, reusing your existing login instead of a separate paid API key.

What language is claude-local-api written in?

Mainly Python. The stack also includes Python, Unix socket, Claude Code CLI.

How hard is claude-local-api to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is claude-local-api for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.