coderoute 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- coderoute-0.1.0.dist-info/METADATA +55 -0
- coderoute-0.1.0.dist-info/RECORD +9 -0
- coderoute-0.1.0.dist-info/WHEEL +5 -0
- coderoute-0.1.0.dist-info/entry_points.txt +3 -0
- coderoute-0.1.0.dist-info/licenses/NOTICE +10 -0
- coderoute-0.1.0.dist-info/top_level.txt +1 -0
- coderoute_cli/__init__.py +1 -0
- coderoute_cli/__main__.py +131 -0
- coderoute_cli/model_settings.yml +9 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: coderoute
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CodeRoute - AI coding agent on cheap Chinese models (DeepSeek/GLM/Kimi), billed in RMB. Built on aider.
|
|
5
|
+
Author: CodeRoute
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://www.bbfps.cloud
|
|
8
|
+
Keywords: ai,coding-agent,aider,deepseek,glm,kimi,llm,cli
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: NOTICE
|
|
18
|
+
Requires-Dist: aider-chat>=0.86
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# CodeRoute CLI
|
|
22
|
+
|
|
23
|
+
用便宜的国产模型(DeepSeek / GLM / Kimi)写代码的命令行编程助手。基于 [aider](https://aider.chat),默认跑在 CodeRoute 网关上,人民币计费、国内直连。
|
|
24
|
+
|
|
25
|
+
## 安装
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install coderoute
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 使用
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
coderoute login # 在控制台建一个 API Key,粘贴进来(一次即可)
|
|
35
|
+
cd 你的项目
|
|
36
|
+
coderoute # 启动,默认 deepseek(最便宜)
|
|
37
|
+
coderoute --model openai/glm-4.7 ... # 换强一点的模型
|
|
38
|
+
coderoute --model openai/kimi-k2-code ... # 长上下文
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
其余参数原样透传给 aider(`--message`、`--yes-always` 等)。
|
|
42
|
+
|
|
43
|
+
## 它做了什么
|
|
44
|
+
|
|
45
|
+
这是 aider 的一层薄包装,启动时锁定:
|
|
46
|
+
- base URL = CodeRoute 网关
|
|
47
|
+
- 默认模型 = `deepseek-fast`
|
|
48
|
+
- 各模型的兼容性怪癖(如 kimi 强制 `temperature=1`)
|
|
49
|
+
|
|
50
|
+
核心编程能力来自 aider(Apache-2.0)。本包仅做品牌与默认配置。
|
|
51
|
+
|
|
52
|
+
## 配置
|
|
53
|
+
|
|
54
|
+
- 本地 key 存于 `~/.config/coderoute/config.json`
|
|
55
|
+
- 临时改网关地址(测试用):环境变量 `CODEROUTE_BASE_URL`、`CODEROUTE_API_KEY`
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
coderoute-0.1.0.dist-info/licenses/NOTICE,sha256=jxp2TWpa6_JzI-4F8KZvlSvO9LxfCb4-vFbhfti6O7E,417
|
|
2
|
+
coderoute_cli/__init__.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
|
|
3
|
+
coderoute_cli/__main__.py,sha256=ad_TKVvKC6H58wHP5ZpMcBSydwugb18SThTZMX4rzQY,4041
|
|
4
|
+
coderoute_cli/model_settings.yml,sha256=O8qCVcOssY0dpp3ZK3dG9gnsP4QFCjxDrqQfXDU2PfA,405
|
|
5
|
+
coderoute-0.1.0.dist-info/METADATA,sha256=y3VEEBzxEP9LsTLhU1T7AwDYdwCca0lBnkTV5yxsZPc,1861
|
|
6
|
+
coderoute-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
7
|
+
coderoute-0.1.0.dist-info/entry_points.txt,sha256=G1qiF3oDOC5vrr3UagZixL8hZCa63Old2AcFyzgkIZg,91
|
|
8
|
+
coderoute-0.1.0.dist-info/top_level.txt,sha256=PJlrGL0V9nCPhevmk8imV5lNyITrQj8qmCQhtEKMtgE,14
|
|
9
|
+
coderoute-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
CodeRoute CLI
|
|
2
|
+
Copyright (c) 2026 CodeRoute
|
|
3
|
+
|
|
4
|
+
This product is a thin wrapper that depends on (but does not modify or
|
|
5
|
+
redistribute the source of) Aider:
|
|
6
|
+
Aider - https://aider.chat - Apache License 2.0
|
|
7
|
+
|
|
8
|
+
The core coding-agent capability is provided by aider-chat, installed as a
|
|
9
|
+
dependency. CodeRoute only supplies branding and locked default configuration
|
|
10
|
+
(gateway base URL, default model, per-model parameter quirks).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
coderoute_cli
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"""CodeRoute CLI - a thin branded wrapper that launches aider against the
|
|
2
|
+
CodeRoute gateway with locked defaults (base URL, default model, model quirks)."""
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
import json
|
|
6
|
+
import getpass
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from . import __version__
|
|
10
|
+
|
|
11
|
+
DEFAULT_BASE_URL = "https://www.bbfps.cloud/v1"
|
|
12
|
+
DEFAULT_MODEL = "openai/deepseek-fast"
|
|
13
|
+
CONFIG_DIR = Path.home() / ".config" / "coderoute"
|
|
14
|
+
CONFIG_FILE = CONFIG_DIR / "config.json"
|
|
15
|
+
SETTINGS_FILE = Path(__file__).parent / "model_settings.yml"
|
|
16
|
+
|
|
17
|
+
BANNER = "CodeRoute - 用便宜的国产模型写代码 (基于 aider)"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def load_config():
|
|
21
|
+
if CONFIG_FILE.exists():
|
|
22
|
+
try:
|
|
23
|
+
return json.loads(CONFIG_FILE.read_text(encoding="utf-8"))
|
|
24
|
+
except Exception:
|
|
25
|
+
return {}
|
|
26
|
+
return {}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def save_config(cfg):
|
|
30
|
+
CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
|
31
|
+
CONFIG_FILE.write_text(json.dumps(cfg, indent=2), encoding="utf-8")
|
|
32
|
+
try:
|
|
33
|
+
os.chmod(CONFIG_FILE, 0o600)
|
|
34
|
+
except Exception:
|
|
35
|
+
pass
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def cmd_login(args):
|
|
39
|
+
cfg = load_config()
|
|
40
|
+
key = None
|
|
41
|
+
base = None
|
|
42
|
+
rest = list(args)
|
|
43
|
+
while rest:
|
|
44
|
+
a = rest.pop(0)
|
|
45
|
+
if a == "--base-url":
|
|
46
|
+
base = rest.pop(0) if rest else None
|
|
47
|
+
elif not a.startswith("-"):
|
|
48
|
+
key = a
|
|
49
|
+
target = base or cfg.get("base_url") or DEFAULT_BASE_URL
|
|
50
|
+
if not key:
|
|
51
|
+
print(f"在控制台创建 API Key 后粘贴到这里(来源 {target}):")
|
|
52
|
+
try:
|
|
53
|
+
key = getpass.getpass("API Key: ").strip()
|
|
54
|
+
except (EOFError, KeyboardInterrupt):
|
|
55
|
+
print("\n已取消。")
|
|
56
|
+
return 1
|
|
57
|
+
if not key:
|
|
58
|
+
print("未输入 key,已取消。")
|
|
59
|
+
return 1
|
|
60
|
+
cfg["api_key"] = key
|
|
61
|
+
if base:
|
|
62
|
+
cfg["base_url"] = base
|
|
63
|
+
save_config(cfg)
|
|
64
|
+
print(f"已保存。base_url={cfg.get('base_url', DEFAULT_BASE_URL)} key={key[:6]}…")
|
|
65
|
+
print("现在直接运行 `coderoute` 即可开始。")
|
|
66
|
+
return 0
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def cmd_logout(_args):
|
|
70
|
+
if CONFIG_FILE.exists():
|
|
71
|
+
CONFIG_FILE.unlink()
|
|
72
|
+
print("已退出登录(本地 key 已删除)。")
|
|
73
|
+
return 0
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def print_help():
|
|
77
|
+
print(BANNER)
|
|
78
|
+
print()
|
|
79
|
+
print("用法:")
|
|
80
|
+
print(" coderoute login 保存网关 API key(一次即可)")
|
|
81
|
+
print(" coderoute [文件...] [aider参数...] 启动编程助手(默认模型 deepseek)")
|
|
82
|
+
print(" coderoute --model openai/glm-4.7 ... 指定其它模型")
|
|
83
|
+
print(" coderoute --model openai/kimi-k2-code ...")
|
|
84
|
+
print(" coderoute logout 删除本地 key")
|
|
85
|
+
print(" coderoute --version")
|
|
86
|
+
print()
|
|
87
|
+
print("其余参数原样透传给底层 aider(如 --message、--yes-always)。")
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def run_agent(args):
|
|
91
|
+
cfg = load_config()
|
|
92
|
+
key = os.environ.get("CODEROUTE_API_KEY") or cfg.get("api_key")
|
|
93
|
+
base = os.environ.get("CODEROUTE_BASE_URL") or cfg.get("base_url") or DEFAULT_BASE_URL
|
|
94
|
+
if not key:
|
|
95
|
+
print("还没登录。先运行: coderoute login")
|
|
96
|
+
return 1
|
|
97
|
+
os.environ["OPENAI_API_BASE"] = base
|
|
98
|
+
os.environ["OPENAI_API_KEY"] = key
|
|
99
|
+
|
|
100
|
+
has_model = any(a == "--model" or a.startswith("--model=") for a in args)
|
|
101
|
+
argv = []
|
|
102
|
+
if not has_model:
|
|
103
|
+
argv += ["--model", DEFAULT_MODEL]
|
|
104
|
+
argv += ["--model-settings-file", str(SETTINGS_FILE), "--no-show-model-warnings"]
|
|
105
|
+
argv += list(args)
|
|
106
|
+
|
|
107
|
+
try:
|
|
108
|
+
from aider.main import main as aider_main
|
|
109
|
+
except Exception as e: # pragma: no cover
|
|
110
|
+
print("启动 aider 失败(依赖未安装?):", e)
|
|
111
|
+
return 1
|
|
112
|
+
return aider_main(argv)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def main():
|
|
116
|
+
argv = sys.argv[1:]
|
|
117
|
+
if argv and argv[0] in ("-V", "--version"):
|
|
118
|
+
print("coderoute", __version__)
|
|
119
|
+
return 0
|
|
120
|
+
if argv and argv[0] == "login":
|
|
121
|
+
return cmd_login(argv[1:])
|
|
122
|
+
if argv and argv[0] == "logout":
|
|
123
|
+
return cmd_logout(argv[1:])
|
|
124
|
+
if argv and argv[0] in ("help", "--help", "-h") and len(argv) == 1:
|
|
125
|
+
print_help()
|
|
126
|
+
return 0
|
|
127
|
+
return run_agent(argv)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
if __name__ == "__main__":
|
|
131
|
+
sys.exit(main() or 0)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# CodeRoute bundled aider model settings for gateway (CodeRoute) models.
|
|
2
|
+
# Pins per-model quirks so end users never have to configure them.
|
|
3
|
+
|
|
4
|
+
# Kimi k2.7-code only accepts temperature=1; aider sends 0 by default -> upstream
|
|
5
|
+
# 400. Forcing it here via client-side extra_params (gateway config cannot override
|
|
6
|
+
# an explicit client temperature).
|
|
7
|
+
- name: openai/kimi-k2-code
|
|
8
|
+
extra_params:
|
|
9
|
+
temperature: 1
|