-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclawapi
More file actions
executable file
·79 lines (63 loc) · 2.13 KB
/
clawapi
File metadata and controls
executable file
·79 lines (63 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/env python3
"""
clawapi - ClawAPI Manager 统一 CLI
"""
import sys
import os
# 添加 lib 目录到路径
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib'))
from config_manager import FreeClawConfigManager
def main():
if len(sys.argv) < 2:
print("""
╔══════════════════════════════════════╗
║ FreeClaw - Unified CLI ║
╚══════════════════════════════════════╝
📋 Configuration Management:
clawapi status Show full status
clawapi providers List all providers
clawapi models [provider] List models
clawapi primary Show primary model
clawapi fallbacks Show fallback chain
🔧 Provider Operations:
clawapi add-provider <name> <url> <key>
clawapi remove-provider <name>
clawapi update-key <provider> <key>
🎯 Model Operations:
clawapi add-model <provider> <id> <name>
clawapi remove-model <provider> <id>
clawapi set-primary <model_id>
clawapi add-fallback <model_id>
clawapi remove-fallback <model_id>
🧪 Testing:
clawapi test <provider> Test provider connection
clawapi validate Validate configuration
💾 Backup:
clawapi backups List all backups
clawapi restore <filename> Restore from backup
Examples:
clawapi status
clawapi providers
clawapi set-primary aiclauder/claude-opus-4-6
clawapi add-fallback minimax/MiniMax-M2.5
""")
return
manager = FreeClawConfigManager()
cmd = sys.argv[1]
# 命令别名
aliases = {
'providers': 'list-providers',
'models': 'list-models',
'primary': 'get-primary',
'fallbacks': 'get-fallbacks',
'backups': 'list-backups'
}
if cmd in aliases:
cmd = aliases[cmd]
# 重新构造参数
sys.argv[1] = cmd
# 调用 config_manager
from config_manager import main as config_main
config_main()
if __name__ == '__main__':
main()