Free · Self-hosted · Open source

Your own
free AI API.
No key needed.

AnyAPI is a self-hosted API server backed by 9 free AI providers. Start it once, call it from Python — build chatbots, automation, CLI tools, or anything that needs language AI.

anyapi — python

One API server. Endless use cases.

Run it as a local service, call it from any Python process. The built-in CLI is just one example client.

// chatbot

Telegram / Discord bots

Wire your bot handler to DaemonClient.send_request("ask", …). Free AI replies with no per-message cost.

// cli

Domain-specific CLIs

Build a code-review tool, a doc generator, a commit-message writer — your own prompt logic on top of the API.

// automation

Scripts & pipelines

Pipe git diff, file contents, or any text. Get structured AI output back in plain Python — no SDK boilerplate.

// agent

Agent pipelines

Route requests across providers, compare outputs, chain reasoning steps — all over a stable local JSON-RPC interface.

Three lines to call it from Python.

Import DaemonClient, point it at the socket, iterate events. That's the whole API surface.

import asyncio
from anyapi.cli.client import DaemonClient
from pathlib import Path

async def ask(prompt: str, provider: str = "duckduckgo") -> str:
    sock = Path.home() / f".local/share/anyapi/{provider}_daemon.sock"
    client = DaemonClient(sock)
    reply = []
    async for event in client.send_request("ask", {"prompt": prompt}):
        if event.event == "token":
            reply.append(event.data)
        elif event.event in ("done", "error"):
            break
    return "".join(reply)

# Summarise a file, review a diff, answer a question…
answer = asyncio.run(ask("Explain this diff: " + open("changes.diff").read()))
print(answer)
# Or pipe it from the shell — the built-in CLI is just another client
$ git diff HEAD~1 | anyapi "Review this diff for bugs"
$ cat main.py | anyapi "Summarise what this does"
$ anyapi "Generate a commit message for: feature/auth-refactor"

JSON-RPC over a Unix socket.

The daemon listens on ~/.local/share/anyapi/<provider>_daemon.sock. Send a newline-delimited JSON request; receive a stream of events.

// Request
{"id": "uuid", "method": "ask", "params": {"prompt": "Hello!"}}

// Response stream
{"id": "uuid", "event": "status", "data": {"stage": "typing"}}
{"id": "uuid", "event": "token",  "data": "Hello"}
{"id": "uuid", "event": "token",  "data": " there"}
{"id": "uuid", "event": "done",   "data": {"text": "Hello there", "chars": 11}}
MethodParamsDescription
askprompt: strSend a prompt — streams token events, then done
new_chatStart a fresh conversation in the browser
save_conversationname?: strSave the current conversation to disk
load_conversationid: strLoad a saved conversation (prefix match)
list_conversationsList all saved conversations
current_conversationReturn full turn history for the active conversation
statsRate-limit counters and session info
healthBrowser and provider health check
reload_authRe-inject cookies without restarting the daemon
shutdownGracefully shut down the daemon

9 providers. 5 work instantly.

No accounts, no API keys, no setup — for the five instant providers. DeepSeek, ChatGPT, Gemini, and Qwen need a one-time cookie export (~5 min).

duckduckgo
Instant

Zero setup, zero login

copilot
Instant

Microsoft Copilot

huggingchat
Instant

Open-source models

perplexity
Instant

Web-search grounded

you
Instant

You.com chat

deepseek
5 min setup

Best free reasoning

chatgpt
5 min setup

OpenAI GPT-4o

gemini
5 min setup

Google Gemini

qwen
5 min setup

Alibaba Qwen

Daemon stays up. Clients are cheap.

Start one daemon per provider. Connect as many clients as you like — your Python script, a bot, a REPL — all sharing the same browser session.

your code
DaemonClient
Python · bot handler
shell script · anything
transport
Unix socket
JSON-RPC · streaming
owner-only permissions
api server
anyapi-daemon
Playwright · Chromium
rate limiter · auth
provider
AI web UI
DeepSeek · ChatGPT
Gemini · 6 more

Two commands to your first API call.

No accounts. No keys. No .env file. Requires Python 3.10+ and ~150 MB for the Chromium download.

1. Install
$pip install anyapi
$playwright install chromium # once
2. Start & call
$anyapi-daemon --provider duckduckgo
# then from Python or shell:
$anyapi "Hello, world!"
★ Star on GitHub Full docs Add a provider