Skip to content

AI Model Guide

Sergey Gerasimov edited this page Oct 23, 2026 · 2 revisions

AI Model Guide

DerivLab uses a provider-agnostic HTTP client. No provider SDK is required; OpenAI-compatible endpoints and Anthropic are supported.


Role recommendations

Role Primary Alternatives Why
AlphaVanguard critic OpenAI GPT-5 (if your organization is verified) Claude Sonnet 4.5, Gemini 2.5 Pro, GPT-4.1 Multi-metric reasoning, nuanced risk critique, strict Markdown.
NewsWire OpenAI GPT-5 mini (if verified) Claude Haiku 4.5, Gemini 2.5 Flash, GPT-4.1-mini Latency and cost matter more than deep reasoning for four headlines.
Autonomous decisions Deterministic local policy GPT-4.1-mini with JSON mode, Claude Haiku 4.5, Qwen3-32B Reproducible and auditable. LLM decisions are opt-in and validated.
Offline / private Qwen3-32B via Ollama or vLLM Llama 3.3 70B, Mistral Small 3 Data stays local and there is no per-call cost.

Verified working configuration

The project was tested with a real OpenAI key:

  • OpenAI model list: gpt-4.1 and gpt-4.1-mini returned 200.
  • gpt-5 and gpt-5-mini returned 404: “Your organization must be verified to use the model.”
  • The live Arena was run with:
    • critic: gpt-4.1 (HTTP 200, valid three-section report)
    • news: gpt-4.1-mini (HTTP 200, four valid headlines)
    • decisions: local deterministic policy (default)

This is the recommended fallback when GPT-5 is not available to your organization.

DERIVLAB_LLM_PROVIDER=openai
DERIVLAB_LLM_BASE_URL=https://api.openai.com/v1
DERIVLAB_LLM_API_KEY=sk-...
DERIVLAB_DECISION_MODEL=gpt-4.1-mini
DERIVLAB_CRITIC_MODEL=gpt-4.1
DERIVLAB_NEWS_MODEL=gpt-4.1-mini

GPT-5 caveat: availability depends on organization verification and the models enabled for your key. DerivLab displays the exact returned error in the Model stack tab and falls back locally; it never hides the failure.


Configuration

Variable Default Purpose
DERIVLAB_LLM_PROVIDER local local, openai, anthropic, openai_compatible, ollama, lmstudio, vllm
DERIVLAB_LLM_API_KEY empty Provider key; never commit it
DERIVLAB_LLM_BASE_URL provider default API base URL
DERIVLAB_LLM_MODEL provider default Shared model for all roles
DERIVLAB_DECISION_MODEL provider default Agent mandates
DERIVLAB_CRITIC_MODEL provider default AlphaVanguard review
DERIVLAB_NEWS_MODEL provider default NewsWire
DERIVLAB_LLM_TIMEOUT 25 Request timeout in seconds

The app loads a project-root .env automatically for local runs. Docker Compose also reads .env for variable substitution; recreate the container after a change:

docker compose up -d --force-recreate

Provider examples

OpenAI

DERIVLAB_LLM_PROVIDER=openai
DERIVLAB_LLM_API_KEY=sk-...
DERIVLAB_DECISION_MODEL=gpt-4.1-mini
DERIVLAB_CRITIC_MODEL=gpt-4.1
DERIVLAB_NEWS_MODEL=gpt-4.1-mini

Anthropic

DERIVLAB_LLM_PROVIDER=anthropic
DERIVLAB_LLM_API_KEY=sk-ant-...
DERIVLAB_CRITIC_MODEL=claude-sonnet-4-5
DERIVLAB_NEWS_MODEL=claude-haiku-4-5

Ollama / vLLM / LM Studio

DERIVLAB_LLM_PROVIDER=ollama
DERIVLAB_LLM_BASE_URL=http://host.docker.internal:11434/v1
DERIVLAB_LLM_MODEL=qwen3:32b

Cost and latency

  • The critic is the expensive call; run it once per cycle.
  • The wire is a fast, low-token call.
  • Agent decisions are local by default; an LLM decision call is optional.
  • A full live cycle with the tested configuration returned in roughly 8–12 seconds for the two narrative calls, excluding simulation time.
  • The app never retries indefinitely; timeouts fall back gracefully.

Security

  • Keys are read from the environment and are never rendered.
  • Docker Compose passes a key from the host environment or .env; production should use Docker secrets because docker inspect can expose environment variables.
  • LLM output is untrusted Markdown; no raw HTML is rendered.
  • See Security.

Evaluation checklist

When choosing a model, test:

  1. Does it follow the exact three headings?
  2. Does it mention the supplied metrics instead of inventing numbers?
  3. Does it return valid JSON for the wire?
  4. Does it handle a provider timeout without breaking the UI?
  5. Does the Model stack tab show the expected model and source?

If any answer is no, the local fallback is doing its job; switch models or keep the deterministic path.


Output quality

Model choice is only one part of reliability. See LLM Quality & Safety for the hard contracts, local fallbacks, and human review rubric.

Clone this wiki locally