File size: 1,156 Bytes
b54a508
 
 
 
 
 
 
 
69fd3e6
 
 
b54a508
69fd3e6
 
b54a508
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import json
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from main import load_config

provider_name = "linuxdoi"
model = "claude-3-5-sonnet"
import asyncio
config, api_keys_db, api_list = asyncio.run(load_config())
import json

print(json.dumps(api_keys_db, indent=2))
exit(0)
providers = config["providers"]
provider_config = None
for provider in providers:
    if provider["provider"] == provider_name:
        provider_config = provider
        break
if provider_config == None:
    print("Provider not found")
    sys.exit(1)
model_name = provider_config["model"][model]
# 定义请求的内容
request_content = {
    "model": model_name,
    "messages": [
        {"role": "user", "content": {"text": "What is the meaning of life?"}}
    ],
    "stream": True
}

# 将请求内容转换为JSON字符串
request_json = json.dumps(request_content)

# 定义curl命令
curl_command = f"""
curl {provider_config["base_url"]} \\
  -H "Content-Type: application/json" \\
  -H "Authorization: Bearer {provider_config['api']}" \\
  -d '{request_json}'
"""

# 打印生成的curl命令
print(curl_command)