Custom Models

Beaver includes an advanced setting for defining custom models through:

  • OpenRouter: Access to dozens of models through a unified API
  • Custom API endpoints: Connect to any OpenAI or Anthropic-compatible API

Using custom models is an advanced feature and should only be used by experienced users.

Important Warnings

  • Unexpected errors may occur: Some functionality may not work correctly
  • Limited image support: Image/vision support depends on the model and must be explicitly enabled (see configuration)
  • Model quirks: Some models produce unusual output (e.g., sentence IDs in responses)
  • Endpoint must be publicly accessible: All requests are routed through Beaver's backend server — not sent directly from your computer. This means your API endpoint must be reachable from the public internet. Endpoints that are only available within a private or institutional network (e.g., a university VPN or intranet) will not work.
  • Security: Custom API endpoints must use HTTPS and cannot point to private/internal networks
  • Misleading error messages: Some models may produce incorrect or misleading error messages.
  • Local LLMs not supported: Since requests are routed through Beaver's backend, local LLMs (e.g., running on localhost) cannot be used.

If you encounter problems with a custom model, always test with a supported model first to determine if the issue is model-specific.

Model Requirements

Custom models must support the following features to work correctly with Beaver:

  • Streaming: The model must support streaming responses (SSE/Server-Sent Events)
  • Tool calling: The model must support function/tool calling

Models that don't support these features will not work properly with Beaver.

Configuration

1

Open Config Editor

Open Zotero → Preferences → Advanced → Config Editor

2

Find the setting

Search for beaver.customChatModels

3

Enter configuration

Enter a valid JSON array with your model configurations (see examples below)

4

Refresh model list

Open and close Beaver settings to refresh the model list

Configuration Fields

FieldRequiredDefaultDescription
providerNo"custom"Either "openrouter" or "custom"
api_keyYes-Your API key for the model provider
nameYes-Display name in model selector
snapshotYes-Model identifier (e.g., "z-ai/glm-4.6", "openai/gpt-5.1-2025-11-13")
api_baseNo*-Custom API endpoint URL (must use HTTPS)
formatNo"openai"API format: "openai" or "anthropic"
context_windowNo128,000Maximum context window in tokens
supports_visionNofalseWhether the model supports image input

* Required if provider is "custom" (or omitted)

Option 1: OpenRouter

OpenRouter provides access to dozens of models through a unified API.

OpenRouter examplejson
[
  {
    "provider": "openrouter",
    "api_key": "sk-or-v1-...",
    "name": "GLM 4.6",
    "snapshot": "z-ai/glm-4.6",
    "context_window": 200000,
    "supports_vision": false
  }
]

Option 2: Custom OpenAI-Compatible Endpoints

Connect to any OpenAI-compatible API endpoint (e.g., proxy servers, alternative cloud providers).

Custom OpenAI-compatible endpointjson
[
  {
    "api_base": "https://api.example.com/v1",
    "format": "openai",
    "api_key": "your-api-key",
    "name": "Custom GPT-4",
    "snapshot": "gpt-4o",
    "context_window": 128000,
    "supports_vision": true
  }
]

Option 3: Custom Anthropic-Compatible Endpoints

Connect to Anthropic-compatible API endpoints.

Custom Anthropic-compatible endpointjson
[
  {
    "api_base": "https://api.example.com",
    "format": "anthropic",
    "api_key": "your-api-key",
    "name": "Custom Claude",
    "snapshot": "claude-3-5-sonnet-20241022",
    "context_window": 200000,
    "supports_vision": true
  }
]

Multiple Models Example

You can add multiple models by including multiple objects in the array:

Multiple models from different sourcesjson
[
  {
    "provider": "openrouter",
    "api_key": "sk-or-v1-...",
    "name": "GLM 4.6 (OpenRouter)",
    "snapshot": "z-ai/glm-4.6",
    "context_window": 200000
  },
  {
    "api_base": "https://api.example.com/v1",
    "format": "openai",
    "api_key": "your-api-key",
    "name": "Custom Provider",
    "snapshot": "llama-3-70b",
    "context_window": 8192
  },
  {
    "api_base": "https://proxy.example.com",
    "format": "anthropic",
    "api_key": "your-api-key",
    "name": "Proxied Claude",
    "snapshot": "claude-3-5-sonnet-20241022",
    "context_window": 200000,
    "supports_vision": true
  }
]

Context Window

The context window setting is used by Beaver to trigger context compression. If 80% of the context window is reached, Beaver will attempt to compress the context to ensure the AI model can continue working effectively in the same conversation. You can artificially set this value to a lower number to trigger context compression sooner and save on costs.

However, the context window setting is not enforced as a hard limit on the total number of tokens in the conversation, and context compression is not guaranteed to sufficiently reduce the input tokens. This has two important implications:

  • You can still run into an error if the input tokens exceed the actual context window of the model.
  • The costs of your requests may be higher if context compression is not effective. Generally, it is best practice to frequently start new threads, which improves model responses, increases cost efficiency, and response speed.

Vision Support

By default, custom models do not support vision (images from PDF reader, area annotations). To enable vision support:

  1. Set "supports_vision": true in your model configuration
  2. Ensure your model/endpoint actually supports vision inputs

When vision is disabled:

  • Images from the PDF reader and area annotations will be omitted from the prompt
  • A text message will inform the model that images were shared but cannot be processed

Only enable supports_vision if your model genuinely supports image input. Enabling it for text-only models may cause errors.

Security & Network Requirements

All API requests from Beaver are routed through Beaver's backend server. They are not sent directly from your computer. This architecture has important implications for custom endpoints:

  • Publicly accessible endpoint required: Your api_base URL must be reachable from the public internet. Endpoints behind a VPN, institutional firewall, or private network will fail because Beaver's server cannot reach them.
  • HTTPS required: Plain HTTP endpoints are blocked.
  • No private networks: Cannot point to localhost, private IPs (10.x.x.x, 192.168.x.x, 172.16-31.x.x), or cloud metadata endpoints (169.254.x.x).

If your AI service is only available within an institutional network (e.g., a university network or VPN), it will not work with Beaver. The API endpoint must be accessible from the public internet.