Merge pull request #134 from shenhao-stu/main

template: upload mykey_template_en.py
This commit is contained in:
LJQ
2026-04-22 19:11:43 +08:00
committed by GitHub
2 changed files with 89 additions and 0 deletions

View File

@@ -263,6 +263,19 @@ mixin_config = {
# # 'fake_cc_system_prompt': False, # MiniMax 不做 CC 指纹校验
# }
# ── 1g. Kimi for Coding (Anthropic 兼容 CC 透传端点) ──────────────────────
# Kimi 官方为 Claude Code / Codex 开放的 /coding 路径,走 Anthropic 协议。
# 与 4b 的 Moonshot OAI 路径是两回事model 用 'kimi-for-coding'(非 kimi-k2
# 官方硬要求透传 CC system prompt → fake_cc_system_prompt=True 必填。
# 文档: https://www.kimi.com/code/docs/third-party-tools/other-coding-agents.html
# native_claude_config_kimi = {
# 'name': 'kimi-coding', # /llms 显示名 & mixin 引用名
# 'apikey': 'sk-kimi-<your-kimi-coding-key>', # Bearer 鉴权
# 'apibase': 'https://api.kimi.com/coding',# Anthropic 兼容端点
# 'model': 'kimi-for-coding', # 官方 coding 专用 model id
# 'fake_cc_system_prompt': True, # 必填;官方硬要求透传 CC 系统串
# 'thinking_type': 'adaptive', # 'adaptive'/'enabled'/'disabled'
# }
# ══════════════════════════════════════════════════════════════════════════════
# 2. NativeOAISession — OpenAI 协议 + 原生工具

76
mykey_template_en.py Normal file
View File

@@ -0,0 +1,76 @@
# ══════════════════════════════════════════════════════════════════════════════
# GenericAgent — mykey.py configuration template (copy to mykey.py and fill in)
# ══════════════════════════════════════════════════════════════════════════════
#
# Quick start:
# 1. Copy this file to mykey.py
# 2. Uncomment one of the configs below and fill in your apikey
# 3. Run `python agentmain.py` or `python launch.pyw`
#
# GA auto-detects any variable whose name contains 'api'/'config'/'cookie'
# and picks the session class by keyword:
# name contains 'native' + 'claude' → NativeClaudeSession (Anthropic API)
# name contains 'native' + 'oai' → NativeOAISession (OpenAI API)
# name contains 'mixin' → MixinSession (failover)
#
# Native = tools go in the API's native `tool` field (function calling), same
# way Claude Code and Codex do it. Recommended for GPT / Claude / Gemini.
#
# Tip: runtime overrides via `/session.<attr>=<val>` in the REPL, e.g.
# /session.reasoning_effort=high
# /session.thinking_type=adaptive
# /session.temperature=0.3
#
# ══════════════════════════════════════════════════════════════════════════════
# ── 1. NativeClaudeSession — Anthropic direct ────────────────────────────────
# Official Anthropic endpoint. apikey starting with 'sk-ant-' is auto-sent
# as x-api-key; any other prefix uses Authorization: Bearer.
# Model suffix '[1m]' triggers the 1M-context beta (stripped before sending).
native_claude_config = {
'name': 'claude', # display name & mixin reference
'apikey': 'sk-ant-<your-anthropic-key>',
'apibase': 'https://api.anthropic.com',
'model': 'claude-opus-4-7[1m]', # or 'claude-sonnet-4-6'
'thinking_type': 'adaptive', # 'adaptive' | 'enabled' | 'disabled'
# 'thinking_budget_tokens': 32768, # required if thinking_type='enabled'
# 'max_retries': 3,
# 'read_timeout': 180,
}
# ── 2. NativeOAISession — OpenAI direct ──────────────────────────────────────
# Standard OpenAI chat/completions endpoint. Also works for any OpenAI-
# compatible provider that supports native function-calling tool fields.
native_oai_config = {
'name': 'gpt', # display name & mixin reference
'apikey': 'sk-<your-openai-key>',
'apibase': 'https://api.openai.com/v1',
'model': 'gpt-5.4', # or 'o4', 'gpt-5.3-codex', etc.
'api_mode': 'chat_completions', # or 'responses' for /v1/responses
# 'reasoning_effort': 'high', # none|minimal|low|medium|high|xhigh
# 'max_retries': 3,
# 'read_timeout': 120,
}
# ── 3. Mixin failover (optional) ─────────────────────────────────────────────
# List sessions by 'name'; if one fails, the next is tried automatically.
# Constraint: all referenced sessions must be Native (mixing Native Claude
# and Native OAI is fine; mixing Native with non-Native is not).
# mixin_config = {
# 'llm_nos': ['claude', 'gpt'],
# 'max_retries': 5,
# 'base_delay': 0.5,
# }
# ── 4. Global HTTP proxy (optional) ──────────────────────────────────────────
# Applies to every session that doesn't set its own 'proxy' field.
# proxy = 'http://127.0.0.1:7890'
# ── 5. Chat platform integrations (optional) ─────────────────────────────────
# tg_bot_token = '...'
# tg_allowed_users = [123456789]