Skip to content

Commit 1939775

Browse files
YC0101Wendong-Fanfengju0213
authored
feat: Add AtlasCloud model integration (#3683)
Co-authored-by: Wendong-Fan <[email protected]> Co-authored-by: Tao Sun <[email protected]> Co-authored-by: Sun Tao <[email protected]>
1 parent ca49027 commit 1939775

File tree

12 files changed

+249
-0
lines changed

12 files changed

+249
-0
lines changed

.github/workflows/build_package.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ jobs:
153153
ACI_API_KEY: "${{ secrets.ACI_API_KEY }}"
154154
BOHRIUM_API_KEY: "${{ secrets.BOHRIUM_API_KEY }}"
155155
MINIMAX_API_KEY: "${{ secrets.MINIMAX_API_KEY}}"
156+
ATLASCLOUD_API_KEY: "${{ secrets.ATLASCLOUD_API_KEY }}"
156157
CRYNUX_API_KEY: "${{ secrets.CRYNUX_API_KEY }}"
157158
NEBIUS_API_KEY: "${{ secrets.NEBIUS_API_KEY }}"
158159
COMETAPI_KEY: "${{ secrets.COMETAPI_KEY }}"

.github/workflows/pytest_package.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ jobs:
9292
QIANFAN_API_KEY: "${{ secrets.QIANFAN_API_KEY }}"
9393
ACI_API_KEY: "${{ secrets.ACI_API_KEY }}"
9494
BOHRIUM_API_KEY: "${{ secrets.BOHRIUM_API_KEY }}"
95+
ATLASCLOUD_API_KEY: "${{ secrets.ATLASCLOUD_API_KEY }}"
9596
CRYNUX_API_KEY: "${{ secrets.CRYNUX_API_KEY }}"
9697
NEBIUS_API_KEY: "${{ secrets.NEBIUS_API_KEY }}"
9798
COMETAPI_KEY: "${{ secrets.COMETAPI_KEY }}"
@@ -183,6 +184,7 @@ jobs:
183184
WATSONX_API_KEY: "${{ secrets.WATSONX_API_KEY }}"
184185
WATSONX_PROJECT_ID: "${{ secrets.WATSONX_PROJECT_ID }}"
185186
QIANFAN_API_KEY: "${{ secrets.QIANFAN_API_KEY }}"
187+
ATLASCLOUD_API_KEY: "${{ secrets.ATLASCLOUD_API_KEY }}"
186188
ACI_API_KEY: "${{ secrets.ACI_API_KEY }}"
187189
BOHRIUM_API_KEY: "${{ secrets.BOHRIUM_API_KEY }}"
188190
CRYNUX_API_KEY: "${{ secrets.CRYNUX_API_KEY }}"
@@ -232,6 +234,7 @@ jobs:
232234
GROQ_API_KEY: "${{ secrets.GROQ_API_KEY }}"
233235
COHERE_API_KEY: "${{ secrets.COHERE_API_KEY }}"
234236
NVIDIA_API_BASE_URL: "${{ secrets.NVIDIA_API_BASE_URL }}"
237+
ATLASCLOUD_API_KEY: "${{ secrets.ATLASCLOUD_API_KEY }}"
235238
NVIDIA_API_KEY: "${{ secrets.NVIDIA_API_KEY }}"
236239
ZHIPUAI_API_BASE_URL: "${{ secrets.ZHIPUAI_API_BASE_URL }}"
237240
ZHIPUAI_API_KEY: "${{ secrets.ZHIPUAI_API_KEY }}"

camel/configs/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from .aiml_config import AIML_API_PARAMS, AIMLConfig
1616
from .amd_config import AMD_API_PARAMS, AMDConfig
1717
from .anthropic_config import ANTHROPIC_API_PARAMS, AnthropicConfig
18+
from .atlascloud_config import ATLASCLOUD_API_PARAMS, AtlasCloudConfig
1819
from .base_config import BaseConfig
1920
from .bedrock_config import BEDROCK_API_PARAMS, BedrockConfig
2021
from .cerebras_config import CEREBRAS_API_PARAMS, CerebrasConfig
@@ -130,6 +131,8 @@
130131
'AMD_API_PARAMS',
131132
'OpenRouterConfig',
132133
'OPENROUTER_API_PARAMS',
134+
'AtlasCloudConfig',
135+
'ATLASCLOUD_API_PARAMS',
133136
'LMSTUDIO_API_PARAMS',
134137
'LMStudioConfig',
135138
'MINIMAX_API_PARAMS',

camel/configs/atlascloud_config.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# ========= Copyright 2023-2026 @ CAMEL-AI.org. All Rights Reserved. =========
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ========= Copyright 2023-2026 @ CAMEL-AI.org. All Rights Reserved. =========
14+
from __future__ import annotations
15+
16+
from typing import Optional
17+
18+
from camel.configs.base_config import BaseConfig
19+
20+
21+
class AtlasCloudConfig(BaseConfig):
22+
r"""Defines the parameters for generating chat completions using OpenAI
23+
compatibility.
24+
25+
Reference: https://www.atlascloud.ai/docs/en/createChatCompletion
26+
27+
Args:
28+
temperature (float, optional): Sampling temperature to use, between
29+
:obj:`0` and :obj:`2`. Higher values make the output more random,
30+
while lower values make it more focused and deterministic.
31+
(default: :obj:`None`)
32+
top_p (float, optional): An alternative to sampling with temperature,
33+
called nucleus sampling, where the model considers the results of
34+
the tokens with top_p probability mass. So :obj:`0.1` means only
35+
the tokens comprising the top 10% probability mass are considered.
36+
(default: :obj:`None`)
37+
stream (bool, optional): If True, partial message deltas will be sent
38+
as data-only server-sent events as they become available.
39+
(default: :obj:`None`)
40+
max_tokens (int, optional): The maximum number of tokens to generate
41+
in the chat completion. The total length of input tokens and
42+
generated tokens is limited by the model's context length.
43+
(default: :obj:`None`)
44+
repetition_penalty (float, optional): Penalty for repeated tokens to
45+
prevent redundancy. (default: :obj:`None`)
46+
"""
47+
48+
temperature: Optional[float] = None
49+
top_p: Optional[float] = None
50+
stream: Optional[bool] = None
51+
max_tokens: Optional[int] = None
52+
repetition_penalty: Optional[float] = None
53+
54+
55+
ATLASCLOUD_API_PARAMS = {
56+
param for param in AtlasCloudConfig.model_fields.keys()
57+
}

camel/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from .aiml_model import AIMLModel
1616
from .amd_model import AMDModel
1717
from .anthropic_model import AnthropicModel
18+
from .atlascloud_model import AtlasCloudModel
1819
from .aws_bedrock_model import AWSBedrockModel
1920
from .azure_openai_model import AzureOpenAIModel
2021
from .base_audio_model import BaseAudioModel
@@ -66,6 +67,7 @@
6667
'BaseModelBackend',
6768
'OpenAIModel',
6869
'OpenRouterModel',
70+
'AtlasCloudModel',
6971
'AzureOpenAIModel',
7072
'AnthropicModel',
7173
'AMDModel',

camel/models/atlascloud_model.py

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# ========= Copyright 2023-2026 @ CAMEL-AI.org. All Rights Reserved. =========
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ========= Copyright 2023-2026 @ CAMEL-AI.org. All Rights Reserved. =========
14+
import os
15+
from typing import Any, Dict, Optional, Union
16+
17+
from camel.configs import AtlasCloudConfig
18+
from camel.models.openai_compatible_model import OpenAICompatibleModel
19+
from camel.types import ModelType
20+
from camel.utils import (
21+
BaseTokenCounter,
22+
api_keys_required,
23+
)
24+
25+
26+
class AtlasCloudModel(OpenAICompatibleModel):
27+
r"""LLM API served by AtlasCloud in a unified OpenAICompatibleModel
28+
interface.
29+
30+
Args:
31+
model_type (Union[ModelType, str]): Model for which a backend is
32+
created.
33+
model_config_dict (Optional[Dict[str, Any]], optional): A dictionary
34+
that will be fed into:obj:`openai.ChatCompletion.create()`.
35+
If:obj:`None`, :obj:`AtlasCloudConfig().as_dict()` will be used.
36+
(default: :obj:`None`)
37+
api_key (Optional[str], optional): The API key for authenticating
38+
with the AtlasCloud service. (default: :obj:`None`).
39+
url (Optional[str], optional): The url to the AtlasCloud service.
40+
(default: :obj:`None`)
41+
token_counter (Optional[BaseTokenCounter], optional): Token counter to
42+
use for the model. If not provided, :obj:`OpenAITokenCounter(
43+
ModelType.GPT_4O_MINI)` will be used.
44+
(default: :obj:`None`)
45+
timeout (Optional[float], optional): The timeout value in seconds for
46+
API calls. If not provided, will fall back to the MODEL_TIMEOUT
47+
environment variable or default to 180 seconds.
48+
(default: :obj:`None`)
49+
max_retries (int, optional): Maximum number of retries for API calls.
50+
(default: :obj:`3`)
51+
**kwargs (Any): Additional arguments to pass to the client
52+
initialization.
53+
"""
54+
55+
@api_keys_required([("api_key", "ATLASCLOUD_API_KEY")])
56+
def __init__(
57+
self,
58+
model_type: Union[ModelType, str],
59+
model_config_dict: Optional[Dict[str, Any]] = None,
60+
api_key: Optional[str] = None,
61+
url: Optional[str] = None,
62+
token_counter: Optional[BaseTokenCounter] = None,
63+
timeout: Optional[float] = None,
64+
max_retries: int = 3,
65+
**kwargs: Any,
66+
) -> None:
67+
if model_config_dict is None:
68+
model_config_dict = AtlasCloudConfig().as_dict()
69+
api_key = api_key or os.environ.get("ATLASCLOUD_API_KEY")
70+
url = url or os.environ.get(
71+
"ATLASCLOUD_API_BASE_URL", "https://api.atlascloud.ai/v1"
72+
)
73+
timeout = timeout or float(os.environ.get("MODEL_TIMEOUT", 180))
74+
super().__init__(
75+
model_type=model_type,
76+
model_config_dict=model_config_dict,
77+
api_key=api_key,
78+
url=url,
79+
token_counter=token_counter,
80+
timeout=timeout,
81+
max_retries=max_retries,
82+
**kwargs,
83+
)

camel/models/model_factory.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from camel.models.aiml_model import AIMLModel
2020
from camel.models.amd_model import AMDModel
2121
from camel.models.anthropic_model import AnthropicModel
22+
from camel.models.atlascloud_model import AtlasCloudModel
2223
from camel.models.aws_bedrock_model import AWSBedrockModel
2324
from camel.models.azure_openai_model import AzureOpenAIModel
2425
from camel.models.base_model import BaseModelBackend
@@ -97,6 +98,7 @@ class ModelFactory:
9798
ModelPlatformType.LMSTUDIO: LMStudioModel,
9899
ModelPlatformType.MINIMAX: MinimaxModel,
99100
ModelPlatformType.OPENROUTER: OpenRouterModel,
101+
ModelPlatformType.ATLASCLOUD: AtlasCloudModel,
100102
ModelPlatformType.ZHIPU: ZhipuAIModel,
101103
ModelPlatformType.GEMINI: GeminiModel,
102104
ModelPlatformType.MISTRAL: MistralModel,

camel/types/enums.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,10 @@ class ModelType(UnifiedModelType, Enum):
515515
MINIMAX_M2 = "MiniMax-M2"
516516
MINIMAX_M2_STABLE = "MiniMax-M2-Stable"
517517

518+
# AtlasCloud models
519+
ATLASCLOUD_GPT_OSS_120B = "openai/gpt-oss-120b"
520+
ATLASCLOUD_GLM_4_7 = "zai-org/glm-4.7"
521+
518522
def __str__(self):
519523
return self.value
520524

@@ -1428,6 +1432,7 @@ def token_limit(self) -> int:
14281432
ModelType.NEBIUS_DEEPSEEK_V3,
14291433
ModelType.NEBIUS_DEEPSEEK_R1,
14301434
ModelType.NEBIUS_GPT_OSS_120B,
1435+
ModelType.ATLASCLOUD_GPT_OSS_120B,
14311436
ModelType.NEBIUS_GPT_OSS_20B,
14321437
ModelType.COMETAPI_GPT_5_CHAT_LATEST,
14331438
ModelType.COMETAPI_CHATGPT_4O_LATEST,
@@ -1521,6 +1526,7 @@ def token_limit(self) -> int:
15211526
ModelType.CLAUDE_SONNET_4,
15221527
ModelType.CLAUDE_OPUS_4,
15231528
ModelType.CLAUDE_OPUS_4_1,
1529+
ModelType.ATLASCLOUD_GLM_4_7,
15241530
ModelType.YI_MEDIUM_200K,
15251531
ModelType.AWS_CLAUDE_3_5_SONNET,
15261532
ModelType.AWS_CLAUDE_3_HAIKU,
@@ -1828,6 +1834,7 @@ class ModelPlatformType(Enum):
18281834
MINIMAX = "minimax"
18291835
CEREBRAS = "cerebras"
18301836
FUNCTION_GEMMA = "function-gemma"
1837+
ATLASCLOUD = "atlascloud"
18311838

18321839
@classmethod
18331840
def from_name(cls, name):
@@ -2023,6 +2030,11 @@ def is_cerebras(self) -> bool:
20232030
r"""Returns whether this platform is Cerebras."""
20242031
return self is ModelPlatformType.CEREBRAS
20252032

2033+
@property
2034+
def is_atlascloud(self) -> bool:
2035+
r"""Returns whether this platform is AtlasCloud."""
2036+
return self is ModelPlatformType.ATLASCLOUD
2037+
20262038

20272039
class AudioModelType(Enum):
20282040
TTS_1 = "tts-1"

camel/types/unified_model_type.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ def is_openrouter(self) -> bool:
109109
r"""Returns whether the model is a OpenRouter served model."""
110110
return True
111111

112+
@property
113+
def is_atlascloud(self) -> bool:
114+
r"""Returns whether the model is a AtlasCloud served model."""
115+
return True
116+
112117
@property
113118
def is_lmstudio(self) -> bool:
114119
r"""Returns whether the model is a LMStudio served model."""

docs/mintlify/key_modules/models.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ CAMEL supports a wide range of models, including [OpenAI’s GPT series](https:/
5353
| **COHERE** | command-r-plus, command-r, command-light, command, command-nightly |
5454
| **ERNIE** | ernie-x1-turbo-32k, ernie-x1-32k, ernie-x1-32k-preview<br/>ernie-4.5-turbo-128k, ernie-4.5-turbo-32k<br/>deepseek-v3, deepseek-r1, qwen3-235b-a22b |
5555
| **MiniMax** | MiniMax-M2, MiniMax-M2-Stable |
56+
| **AtlasCloud** | openai/gpt-oss-120b, zai-org/glm-4-7 |
5657

5758

5859
### API & Connector Platforms

0 commit comments

Comments
 (0)