0610

ToshLLM field guide

Integrations

Connect ToshLLM to Claude Code, Anthropic SDKs, VS Code, Zed, OpenCode, Aider and other local clients.

Connection essentials

One local server. Your preferred tools.

Start a model in ToshLLM before opening the client. Most integrations need the same three values:

Base URLhttp://127.0.0.1:8080/v1
Model IDGET /v1/models
API keyFrom ToshLLM Settings

Use the exact id returned by GET /v1/models. Router mode exposes a stable alias for each downloaded model. If API protection is disabled but a client requires a value, enter toshllm-local; the local server will ignore it.

OpenAI base URLhttp://127.0.0.1:8080/v1
Anthropic base URLhttp://127.0.0.1:8080
curl http://127.0.0.1:8080/v1/models \
  -H "Authorization: Bearer YOUR_TOSHLLM_KEY"
Keep the address local.

Use 127.0.0.1 when the client runs on the same Mac. Enable local-network discovery only for another trusted device, and protect the API with a key first.

Compatibility

Choose a client that stays direct.

ClientConnectionBest use
Claude CodeDirectLocal coding agent
Anthropic SDKsDirectMessages API applications
Continue for VS CodeDirectChat, edit and apply
Cline or Roo CodeDirectAgent workflows
ZedDirectEditor assistant
OpenCodeDirectTerminal coding agent
AiderDirectRepository edits
CursorLimitedNo reliable private localhost route
Claude Code

Route the agent directly to ToshLLM.

Claude Code officially supports Anthropic-compatible gateways through environment variables. ToshLLM exposes the required Messages API, authentication headers and model discovery endpoint locally.

export ANTHROPIC_BASE_URL=http://127.0.0.1:8080
export ANTHROPIC_AUTH_TOKEN=YOUR_TOSHLLM_KEY
export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1

claude
  1. Start ToshLLM in Router mode or run the model you want to use.
  2. Copy the API key from ToshLLM Settings. Use toshllm-local if protection is disabled.
  3. Export the variables in the same terminal where you will launch Claude Code.
  4. Open /model and choose the local model reported by ToshLLM.
Choose the model carefully.

Claude Code is an agent workflow with frequent tool calls and long prompts. Use a model with strong instruction following and tool support, enable Agent tools in ToshLLM and configure enough context for the repository.

Gateway model discovery requires Claude Code 2.1.129 or newer. Without it, select a model explicitly through Claude Code's model configuration.

Claude Code gateway reference ↗
Anthropic SDKs

Build against the Messages API you already know.

Set the Anthropic client's base URL to the ToshLLM server root and use any model ID returned by GET /v1/models. The API supports regular messages, streaming, token counting and client-defined tools.

from anthropic import Anthropic

client = Anthropic(
    base_url="http://127.0.0.1:8080",
    api_key="YOUR_TOSHLLM_KEY",
)

response = client.messages.create(
    model="MODEL_ID",
    max_tokens=512,
    messages=[{"role": "user", "content": "Review this function."}],
)

print(response.content[0].text)

The model name does not need to be a Claude model. It identifies the local GGUF model that ToshLLM should run. See the Local API guide for raw requests, streaming and token counting.

Anthropic Python SDK reference ↗
VS Code

Continue, Cline or Roo Code.

All three extensions support OpenAI-compatible providers. Continue is a clean choice for chat and editing. Cline and Roo Code are better suited to agent workflows that call tools and modify a workspace.

Recommended for everyday work

Continue

Official setup ↗

Add a model to your Continue YAML configuration. Replace MODEL_ID with the value returned by ToshLLM.

name: ToshLLM Local
version: 1.0.0
schema: v1
models:
  - name: ToshLLM
    provider: openai
    model: MODEL_ID
    apiBase: http://127.0.0.1:8080/v1
    apiKey: YOUR_TOSHLLM_KEY
    roles:
      - chat
      - edit
      - apply
Recommended for agents

Cline and Roo Code

  1. Open the extension settings and select OpenAI Compatible.
  2. Set the Base URL to http://127.0.0.1:8080/v1.
  3. Enter the ToshLLM API key, or toshllm-local if protection is off.
  4. Enter the exact ToshLLM model ID and set its context window to match the running server.

Tool use depends on the selected model and the server's agent-tools setting. Start with chat, then enable tool workflows after confirming the model follows function calls reliably.

Zed

Use the native llama.cpp provider.

Zed includes a local llama.cpp provider that points at the server root rather than the /v1 base URL. Add the model in Zed's settings JSON.

{
  "language_models": {
    "llama.cpp": {
      "api_url": "http://127.0.0.1:8080",
      "auto_discover": false,
      "available_models": [
        {
          "name": "MODEL_ID",
          "display_name": "ToshLLM Local",
          "max_tokens": 8192,
          "supports_tools": false,
          "supports_images": false
        }
      ]
    }
  }
}

Match max_tokens to the context configured in ToshLLM. Set tool and image support to the actual capabilities of the running model.

Read Zed's local-model guide ↗
OpenCode

Create a local custom provider.

Run /connect, choose Other, use toshllm as the provider ID and store the ToshLLM key. Then add this provider to opencode.json.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "toshllm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "ToshLLM Local",
      "options": {
        "baseURL": "http://127.0.0.1:8080/v1"
      },
      "models": {
        "MODEL_ID": {
          "name": "ToshLLM Local Model"
        }
      }
    }
  }
}

OpenCode's OpenAI-compatible package uses /v1/chat/completions, which matches ToshLLM's local API.

Read OpenCode's custom-provider guide ↗
Aider

Point the CLI at ToshLLM.

Set the OpenAI-compatible endpoint and launch Aider with the openai/ model prefix.

export OPENAI_API_BASE=http://127.0.0.1:8080/v1
export OPENAI_API_KEY=YOUR_TOSHLLM_KEY
aider --model openai/MODEL_ID

For a persistent setup, place the base URL, key and model in ~/.aider.conf.yml instead of exporting them for every terminal session.

Read Aider's OpenAI-compatible guide ↗
Cursor compatibility

Do not assume localhost remains private.

Cursor's current official bring-your-own-key flow supports listed cloud providers and states that requests are routed through Cursor's servers for final prompt construction. That path cannot reliably reach a ToshLLM server bound to 127.0.0.1, and it does not provide the same direct local connection as the integrations above.

Recommendation

Use Continue, Cline or Roo Code in VS Code when a direct local coding workflow is required. Revisit Cursor only if a future release officially supports arbitrary localhost OpenAI-compatible endpoints without routing the request through its backend.

Read Cursor's current API-key behavior ↗
Any compatible client

Use the same connection contract.

A client is a candidate when it accepts an OpenAI-compatible base URL for /v1/chat/completions or /v1/responses, or an Anthropic-compatible base URL for /v1/messages. Use the exact model ID returned by ToshLLM and confirm which protocol the client expects.

Review the complete local API guide for network access, authentication and router mode.