{
  // Copy this file to config/config.jsonc beside system-prompt.md.
  // Supply the environment variables referenced below through Docker Compose or your supervisor.
  "version": 1,
  "data_dir": "/data",
  "timezone": "Asia/Shanghai",
  // Optional: delete this whole section (or just "token") to run without Telegram.
  // The Admin Panel and Playground rooms keep working; no Bot is connected.
  "telegram": {
    "token": { "env": "TELEGRAM_BOT_TOKEN" },
    "process_bot_messages": false,
    "bucket_window_seconds": 15,
    // Optional: each new message pushes the batch to at least its arrival plus
    // this (0 = fixed window), but never past the first message plus the max.
    "bucket_bump_seconds": 0,
    "bucket_max_seconds": 15,
    "chats": [
      {
        "id": 123456789,
        "ignored_user_ids": []
      }
    ]
  },
  "providers": {
    "gateway": {
      "kind": "custom",
      "base_url": "https://api.example.com/v1",
      "api": "openai-responses",
      "api_key": { "env": "SUROWAN_API_KEY" },
      "models": [
        {
          "id": "replace-with-your-text-and-image-model",
          "name": "Replace with an available model",
          "reasoning": false,
          "input": ["text", "image"],
          "context_window": 128000,
          "max_tokens": 8192,
          "cost": { "input": 0, "output": 0, "cache_read": 0, "cache_write": 0 }
        }
      ]
    }
  },
  "agent": {
    "provider": "gateway",
    "model": "replace-with-your-text-and-image-model",
    "daily_budget": { "max_tokens": 300000 },
    "thinking_level": "off",
    "system_prompt_file": "system-prompt.md",
    "max_concurrency": 4,
    "context_stop_ratio": 0.7,
    "history_messages": 20,
    // 可选，默认 false：同一消息默认只回复一次（文字/贴纸/图片共享）；true 允许对同一消息多次回复，但不绕过授权、预算、限流与图片交付去重。热更新，下一次 Invocation 生效。
    "allow_reply_message_multiple_times": false,
    // 可选，默认 true：同一 Invocation 内拒绝与已成功发送完全一致的文本或贴纸，以及把上一条的内容换个引用目标重发，被拒超过 3 次即结束本次运行；false 关闭。热更新，下一次 Invocation 生效。
    "send_duplicate_guard_enabled": true,
    // 可选，默认 "reject"：模型调用 send 却没写文字时的策略。"reject" 退回发送；"silent_success" 返回成功但不发送任何消息（连续三次结束本次运行）；"random_text" 改为发出 send_empty_text_fallback_texts 中随机一条（默认 "……"）。热更新，下一次 Invocation 生效。
    "send_empty_text_strategy": "reject",
    // 仅 random_text 使用；一行一条。
    "send_empty_text_fallback_texts": ["……"],
    "context": {
      "retained_sends_target": 2,
      "retained_sends_max": 3,
      "hard_token_ratio": 0.6,
      "ref_ttl_hours": 72,
      "idle_grace_seconds": 30,
      "max_wall_clock_seconds": 900,
      "agent_cache_size": 8
    },
    "rate_limits": {
      "sends_per_window": 6,
      "window_seconds": 300,
      "turns_per_injection": 8
    }
  },
  // 可选；整段省略、null 或缺 provider/model 时 read_image 不可用、Sticker 索引暂停，其余字段有默认值。
  "vision": {
    "provider": "gateway",
    "model": "replace-with-your-text-and-image-model",
    "max_output_tokens": 2048,
    "max_concurrency": 2,
    "prompt_version": 1,
    "daily_budget": { "max_tokens": 200000, "max_images": 200 }
  },
  // 可选；整个 image 段省略即图片生成禁用，任何字段变化都热更新、无需重启。
  "image": {
    "credentials": {
      // 明文建议写入同目录 key.json 的 jar 后以 {jar} 引用；这里演示环境变量方式。
      "openrouter": { "env": "OPENROUTER_API_KEY" }
    },
    "models": [
      {
        "id": "gpt-image-1",
        "name": "GPT Image",
        // 可选：该模型路由的用途/画风与提示词风格备注（最长 1000 字符），只供 Agent 选型参考，不发给生图上游。
        "description": "示例偏好：日常插画优先选用；用自然语言描述主体、构图和光线",
        "provider": "openrouter",
        "upstreamModel": "openai/gpt-image-1",
        "credentialRef": "openrouter",
        "providerTag": "openrouter",
        "capabilities": {
          "imageInput": true,
          "maxInputImages": 4,
          "maxOutputs": 4,
          "aspectRatios": ["auto", "1:1", "3:4", "4:3", "9:16", "16:9"],
          "resolutionClasses": ["auto", "low", "medium", "high"]
        }
      }
    ]
  },
  // 网络搜索默认不启用；去掉注释即可开启。模型用 web_search 发现来源，再用 web_fetch 读正文。
  // 每个引擎的 note 对模型可见；SearXNG 必须填 endpoint 且不接受密钥。
  // "web_search": {
  //   "engines": [
  //     { "id": "main", "provider": "tavily", "api_key": { "jar": "tavily" }, "note": "中文技术博客与更新日志" },
  //     { "id": "local", "provider": "searxng", "endpoint": "https://searx.example.com", "note": "私有实例" }
  //   ],
  //   "url_filters": ["csdn"]
  // },
  "retention": { "online_days": 30, "backup_copies": 7 },
  // 可省略；仅在排查模型调用时开启，历史报文在 Developer 页面手动清除。
  "developer": { "record_model_payloads": false },
  "paths": {
    "database": "/data/surowan.sqlite",
    "media_cache": "/data/media-cache",
    "backups": "/data/backups"
  },
  // Required section. "enabled" defaults to true when omitted.
  "admin": {
    "enabled": true,
    "host": "0.0.0.0",
    "port": 8787,
    "session_ttl_hours": 24
  }
}
