blackthorn serve runs an API on your own machine that speaks OpenAI’s Chat Completions and Responses APIs and Anthropic’s Messages API. It seals each prompt there, so only the engine inside the GPU can read it, and the host and the network see ciphertext. A coding agent uses that local API as its model.
The hosted API, bt-api.arcium.com, serves Qwen 3.8 27B Abliterated (qwen3.8-27b-bllm). See Models and GPUs.
Set up blackthorn serve
1
Install the CLI
Tool choice, web fetch and tool search need
blackthorn 0.6.0 or newer, the 256k context needs 0.5.0 or newer, blackthorn codex needs 0.4.0 or newer, and blackthorn claude and the shared prompt prefix need 0.3.0 or newer. Download the prebuilt binary (x86_64 or aarch64, Linux or macOS):2
Log in and check the engine
3
Start the server
--verbose to log each request’s size, how much of it the engine already held, and how long it took.blackthorn claude and blackthorn codex start only if the server on their port is blackthorn serve. Any other server there would receive your prompts unencrypted.Claude Code
serve speaks Anthropic’s Messages API (/v1/messages and /v1/messages/count_tokens), so Claude Code talks to it directly, with no translating proxy. blackthorn claude starts Claude Code pointed at it.
1
Install Claude Code
blackthorn claude runs the claude on your PATH.2
Run it
With Arguments after If
blackthorn serve running, in another terminal:-- go to claude. For one prompt:--bare skips Claude Code’s own system prompt, and --tools limits the tools. --tools takes every argument after it as a tool name, so put the prompt right after -p:serve listens on another port, pass the same --port to blackthorn claude.blackthorn claude sets up Claude Code for the engine:
- API:
ANTHROPIC_BASE_URLpoints atserve, with a placeholder token.serveaccepts requests only from this machine and seals them with your Blackthorn API key. - Model: the engine’s model for every task, including subagents and small background tasks.
- Limits: the engine’s context (
CLAUDE_CODE_MAX_CONTEXT_TOKENS, 262144 withblackthorn0.5.0 or newer), answers of at most 4,096 tokens, short Bash output (BASH_MAX_OUTPUT_LENGTH=1500), a 10-minute request timeout, and no nonessential traffic. Your environment overrides any of these. - Background requests: off (
awaySummaryEnabledandpromptSuggestionEnabled).
CLAUDE.md, memory, skills, plugins, agents, MCP servers and output style.
What to expect
The engine keeps each conversation open. Each step sends only the tokens that are new since the last step, so only the first step of a conversation is slow: the engine reads the whole prompt then. Your setup adds to that prompt:CLAUDE.md, the memory index, the skill and agent lists, and an output style all go into it. --bare keeps it short, and the shared prompt prefix saves reading Claude Code’s tools.
serve --verbose prints a line per request, for example:
held counts the tokens the engine already had from the earlier steps. When a request starts a new conversation although one was open, --verbose says where the prompt parted from the closest open conversation.
A tool that Claude Code loads with its ToolSearch tool joins the conversation at the step that found it, not the tool list at the start of the prompt, so loading one keeps the conversation the engine holds (blackthorn 0.6.0 or newer).
The engine keeps a few conversations open at a time, across all its users. When they are all in use, a new conversation closes the one used least recently, and that conversation’s next step reads it again in full, which takes longer the longer it has grown.
The context is 262,144 tokens, prompt and answer together. Each step sends only what is new, but a long prompt the engine has not read, such as a resumed session, is read in full first and takes a while. Keeping Bash output short leaves more room for the conversation. Qwen3.8-27B handles simple agent steps, such as reading a file to answer a question, but it is far smaller than the models Claude Code is built for.
Shared prompt prefix
Claude Code’s tool definitions come first in its prompt: about 8,600 tokens interactively, 7,600 with-p. They are the same in every conversation of a Claude Code release, whatever its output style, agents, skills or MCP servers. The engine keeps one shared copy of them. A new conversation starts from that copy instead of reading the tools again. The first conversation to find no copy reads them and publishes them for the next.
- What is shared: only the prompts built into
blackthorn, one per Claude Code release, matched on your machine against your own tokens. Another Claude Code release, or a setup that changes the tool list (such as--disallowedTools, or tool search turned off), shares nothing, and the conversation reads its whole prompt as before. Everything after the tools, including yourCLAUDE.mdand memory, is always read per conversation. - What the host learns: never what the copy holds, but which conversations started from it, so it can tell that you run Claude Code.
- One copy: interactive and
-pprompts have different tools, so they replace each other’s copy.blackthorn0.6.0 shares a different copy from older versions, so the two also replace each other’s. - Turning it off:
blackthorn serve --no-shared-prefix.
serve --verbose names the shared prompt when a conversation forks the copy (forked Claude Code 2.1.319 (interactive): tools) or publishes it (published …).
Codex
Codex speaks only OpenAI’s Responses API, andserve speaks it too (/v1/responses). blackthorn codex starts Codex pointed at it.
1
Install Codex
blackthorn codex runs the codex on your PATH.2
Run it
With Arguments after If
blackthorn serve running, in another terminal:-- go to codex. For one prompt:serve listens on another port, pass the same --port to blackthorn codex.blackthorn codex sets up Codex for the engine with -c settings:
- Provider: a provider of its own that uses the Responses API at
serve, and the engine’s model.serveaccepts requests only from this machine and seals them with your Blackthorn API key. - Limits: the engine’s context (
model_context_window, 262144 withblackthorn0.5.0 or newer), so that Codex compacts the conversation before it is full, and tool output cut at 1,000 tokens (tool_output_token_limit=1000). - Tools: no web search and no sub-agents (
web_search="disabled",features.multi_agent=false). The engine cannot serve them.
-c key=value in the arguments after -- overrides any of these. The rest of your Codex setup still applies, such as ~/.codex/config.toml and AGENTS.md.
What to expect
Codex sends the whole conversation with every request. It returns an answer’s text and its tool calls as separate items, andserve reads them back as the one turn they were, so each step extends the conversation the engine holds and sends only what is new. The first step of a conversation reads Codex’s whole first prompt: its instructions, tools, skills list and environment, over 6,000 tokens for Codex 0.153, more with your own skills and AGENTS.md. There is no shared prompt prefix for Codex, so every new Codex conversation reads all of it.
Codex compacts the conversation when it fills 90% of the context. It asks for the summary with a request that carries no tools, so as sent, that request would match the open conversation only on its first tokens and the engine would read the whole conversation again. serve recognizes the request, which Codex marks as a compaction, and reads it with the tools of the conversation it continues, plus a note that no tool can be called. The engine then reads only the request for the summary. serve does this only when it leaves room for the summary. After a compaction, Codex starts a new conversation from the summary, and the engine reads that new prompt in full.
serve --verbose says when it reads a compaction this way:
As with Claude Code, the context is 262,144 tokens, prompt and answer together, and Qwen3.8-27B is far smaller than the models Codex is built for. It handles simple steps, such as reading a file or running a command to answer a question.
Other agents
An agent that speaks any of these APIs can useserve directly, with any API key:
- OpenAI’s Chat Completions API: base URL
http://127.0.0.1:8000/v1.system,tools(function and custom), assistanttool_callsandtoolmessages work as in OpenAI’s API. There are no images, andfrequency_penalty,presence_penalty,logprobsandn > 1are not supported. - Anthropic’s Messages API: base URL
http://127.0.0.1:8000. Tools and system messages work, including system messages between turns. Anthropic’s bash, text editor and memory tools get their schemas, and your agent runs them as usual.serveruns the web fetch and tool search tools itself. What a text-only model cannot take is left out rather than refused: an image becomes a note that it was left out, earlier thinking blocks are dropped, and so are the other tools Anthropic runs itself, such as web search and code execution. - OpenAI’s Responses API: base URL
http://127.0.0.1:8000/v1. Nothing is stored, so send the whole conversation ininputevery time;previous_response_idis refused.instructions, messages, function, custom and namespaced tools, and theshell(local),local_shellandapply_patchtools work, with their calls and outputs, streamed or not. Your agent runs these tools. An image or a file becomes a note that it was left out, and reasoning items and the tools OpenAI runs itself, such as web search, file search and image generation, are dropped. An omittedmax_output_tokensis 4,096.
tool_choice works in all three, with blackthorn 0.6.0 or newer: auto, none, a required call (any in Anthropic’s API, required in OpenAI’s), a named tool, and in OpenAI’s APIs allowed_tools. Turning parallel calls off (disable_parallel_tool_use, parallel_tool_calls: false) ends the answer after its first call. A schema’s strict is shown to the model but not enforced, so check the arguments as you would any model output.
An omitted temperature takes the model’s default, listed in Models and GPUs. The Quickstart has examples for Chat Completions and Anthropic’s API.
Web fetch and tool search
Withblackthorn 0.6.0 or newer, serve runs two of the tools Anthropic runs itself in its Messages API, on your machine: web fetch (web_fetch_*) and tool search (tool_search_tool_regex_* and tool_search_tool_bm25_*). The model calls one, serve runs it and gives the result back to the model, and the answer goes on in the same request, with the call and its result in the response as Anthropic returns them.
- Web fetch fetches a URL only if it is already in the conversation: in your messages, in a tool result, or in a page fetched earlier. The model cannot make up a URL to send out what it has read.
servenever fetches this machine or your local network, and it takesmax_uses,allowed_domainsorblocked_domains, andmax_content_tokens. It reads HTML and text pages, not PDFs. The fetch goes from your machine, so the site sees your IP address and which page was read, but never your prompt. - Tool search searches the tools marked
defer_loadingby regular expression or BM25. Those tools stay out of the prompt until a search finds them, and the model can then call them. - Steps: a request runs at most 10 of these calls. Then it ends with
stop_reasonpause_turn; send the conversation back as it is to go on.