Getting started

Configuration

Everything is configured through environment variables. Secrets stay in a .env file or the OS keyring, never in a prompt or a source file.

Where settings are read from

Vibe-Trading reads the first of these files that exists, and only that one:

  1. ~/.vibe-trading/.env — written by vibe-trading init
  2. agent/.env in a source checkout
  3. .env in the current directory

A variable exported in your shell always wins over the file. The Settings page of the web UI edits the model and data-source values for you.

Model provider

VariableMeaning
LANGCHAIN_PROVIDERProvider name: openrouter, deepseek, openai, anthropic, gemini, ollama, … (25 built in)
LANGCHAIN_MODEL_NAMEModel id, for example deepseek-v4-pro
<PROVIDER>_API_KEYThe key, for example DEEPSEEK_API_KEY
<PROVIDER>_BASE_URLThe API endpoint
LANGCHAIN_REASONING_EFFORTOptional: none, low, medium, high or max
LANGCHAIN_PROVIDER=deepseek
LANGCHAIN_MODEL_NAME=deepseek-v4-pro
DEEPSEEK_API_KEY=sk-xxx
DEEPSEEK_BASE_URL=https://api.deepseek.com/v1
  • ChatGPT sign-in (Codex): set LANGCHAIN_PROVIDER=openai-codex and run vibe-trading provider login openai-codex. No OPENAI_API_KEY is used; the default model is gpt-6-sol.
  • GitHub Copilot: pip install "vibe-trading-ai[copilot]", then LANGCHAIN_PROVIDER=copilot; it signs in with your gh or Copilot CLI credentials.
  • Ollama: no key needed.

Choosing a model

Everything the agent does goes through tool calls, so the model decides whether it uses its tools or answers from memory. Use a strong tool-calling model for long research runs, swarms and multi-step backtests. Avoid *-nano, *-flash-lite and small distilled models: their tool calls are unreliable, and the answer will look fluent while no data was fetched.

Market-data keys (optional)

A-shares, Hong Kong, US, Canada, UK, India, Korea, crypto and forex all work without a key. Keys add sources or depth:

  • TUSHARE_TOKEN — richer A-share, fund and macro data.
  • GILDATA_TOKEN — Hundsun Juyuan commercial A-share feed.
  • Finnhub, Alpha Vantage, Tiingo and FMP keys — extra US sources.
  • Data partner: Gildata. Each Gildata feature requires a token and a separate opt-in in Settings.

See Data sources for which source serves which market.

Long runs and timeouts

VariableDefaultMeaning
VIBE_TRADING_CONTEXT_WINDOWsee belowYour model's context window in tokens. Without it, the window comes from a limit the provider reported during the run, else the built-in model catalog, else 128K.
VIBE_TRADING_CONTEXT_MAX_TOKENS200000The most one request may send, whatever the window. It caps cost.
TIMEOUT_SECONDS120Timeout of one model request.
VIBE_TRADING_TOOL_TIMEOUT_SECONDS1800Hard timeout of a read-only tool or a backtest; 0 disables it.

TOKEN_THRESHOLD was removed in 0.1.16. It is ignored with a warning; delete it from your .env.

Serving beyond your own machine

Without API_AUTH_KEY, the API answers sensitive requests only from the same machine. To use the web UI from another device, set a strong API_AUTH_KEY, send Authorization: Bearer <key> from clients, and enter the same key once in the web UI's Settings. VIBE_TRADING_EXTRA_CORS_ORIGINS adds allowed browser origins.

Shell tools are enabled only in the local interactive terminal. The API and the MCP server keep them off unless you set VIBE_TRADING_ENABLE_SHELL_TOOLS=1.

Files and folders

  • VIBE_TRADING_HOME — where runs, sessions, memory, connectors and the audit ledger live; default ~/.vibe-trading.
  • VIBE_TRADING_ALLOWED_FILE_ROOTS — extra folders, comma-separated, from which documents and broker journals may be imported.
  • VIBE_TRADING_ALLOWED_RUN_ROOTS — extra folders in which generated strategy code may run.