Skip to content

Commit 50e30ed

Browse files
doraemonlovewangjiajuyaozheng-fang
authored
Fix/ark bp (#435)
* Add ark bp * Add ark veauth bp --------- Co-authored-by: wangjiaju <wangjiaju.716@bytedance.com> Co-authored-by: yaozheng-fang <fangyaozheng@bytedance.com>
1 parent 0533daf commit 50e30ed

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

veadk/auth/veauth/ark_veauth.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ def get_ark_token(region: str = "cn-beijing") -> str:
3535
secret_key = cred.secret_access_key
3636
session_token = cred.session_token
3737

38+
provider = os.getenv("CLOUD_PROVIDER")
39+
host = "open.volcengineapi.com"
40+
if provider and provider.lower() == "byteplus":
41+
region = "ap-southeast-1"
42+
host = "open.byteplusapi.com"
43+
3844
res = ve_request(
3945
request_body={"ProjectName": "default", "Filter": {"AllowAll": True}},
4046
header={"X-Security-Token": session_token},
@@ -44,8 +50,9 @@ def get_ark_token(region: str = "cn-beijing") -> str:
4450
service="ark",
4551
version="2024-01-01",
4652
region=region,
47-
host="open.volcengineapi.com",
53+
host=host,
4854
)
55+
logger.info(f"Successfully fetched ARK API Key list: {res}")
4956
try:
5057
first_api_key_id = res["Result"]["Items"][0]["Id"]
5158
logger.warning("By default, VeADK fetches the first API Key in the list.")
@@ -65,7 +72,7 @@ def get_ark_token(region: str = "cn-beijing") -> str:
6572
service="ark",
6673
version="2024-01-01",
6774
region=region,
68-
host="open.volcengineapi.com",
75+
host=host,
6976
)
7077
try:
7178
api_key = res["Result"]["ApiKey"]

veadk/consts.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
import time
16-
16+
import os
1717
from veadk.utils.misc import getenv
1818
from veadk.version import VERSION
1919

@@ -76,6 +76,19 @@
7676
DEFAULT_NACOS_GROUP = "VEADK_GROUP"
7777
DEFAULT_NACOS_INSTANCE_NAME = "veadk"
7878

79+
provider = os.getenv("CLOUD_PROVIDER")
80+
81+
if provider and provider.lower() == "byteplus":
82+
DEFAULT_MODEL_AGENT_NAME = "seed-1-6-250915"
83+
DEFAULT_MODEL_AGENT_API_BASE = "https://ark.ap-southeast.bytepluses.com/api/v3"
84+
DEFAULT_IMAGE_EDIT_MODEL_NAME = "seededit-3-0-i2i-250628"
85+
DEFAULT_IMAGE_EDIT_MODEL_API_BASE = "https://ark.ap-southeast.bytepluses.com/api/v3"
86+
DEFAULT_VIDEO_MODEL_NAME = "seedance-1-5-pro-251215"
87+
DEFAULT_VIDEO_MODEL_API_BASE = "https://ark.ap-southeast.bytepluses.com/api/v3"
88+
DEFAULT_IMAGE_GENERATE_MODEL_NAME = "seedream-4-5-251128"
89+
DEFAULT_IMAGE_GENERATE_MODEL_API_BASE = (
90+
"https://ark.ap-southeast.bytepluses.com/api/v3"
91+
)
7992
DEFAULT_MODEL_EMBEDDING_NAME = "doubao-embedding-vision-250615"
8093
DEFAULT_MODEL_EMBEDDING_API_BASE = "https://ark.cn-beijing.volces.com/api/v3/"
8194
DEFAULT_MODEL_EMBEDDING_DIM = 2048

0 commit comments

Comments
 (0)