File size: 839 Bytes
cbc00ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# -*- coding: utf-8 -*-
# Copyright (c) Alibaba, Inc. and its affiliates.

import os

from dashscope.common.constants import (
    DASHSCOPE_API_KEY_ENV,
    DASHSCOPE_API_KEY_FILE_PATH_ENV,
    DASHSCOPE_API_REGION_ENV,
    DASHSCOPE_API_VERSION_ENV,
)

api_region = os.environ.get(DASHSCOPE_API_REGION_ENV, "cn-beijing")
api_version = os.environ.get(DASHSCOPE_API_VERSION_ENV, "v1")
# read the api key from env
api_key = os.environ.get(DASHSCOPE_API_KEY_ENV)
api_key_file_path = os.environ.get(DASHSCOPE_API_KEY_FILE_PATH_ENV)

# define api base url, ensure end /
base_http_api_url = os.environ.get(
    "DASHSCOPE_HTTP_BASE_URL",
    f"https://dashscope.aliyuncs.com/api/{api_version}",
)
base_websocket_api_url = os.environ.get(
    "DASHSCOPE_WEBSOCKET_BASE_URL",
    f"wss://dashscope.aliyuncs.com/api-ws/{api_version}/inference",
)