Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
# JINA API (https://jina.ai/)
# JINA_API_KEY="Fill your API key here"

# BurnCloud API (https://ai.burncloud.com)
# BURNCLOUD_API_KEY="Fill your API key here"
# BURNCLOUD_API_BASE_URL="Fill your Base URL here"

#===========================================
# Tools & Services API
#===========================================
Expand Down
3 changes: 3 additions & 0 deletions camel/configs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .anthropic_config import ANTHROPIC_API_PARAMS, AnthropicConfig
from .base_config import BaseConfig
from .bedrock_config import BEDROCK_API_PARAMS, BedrockConfig
from .burncloud_config import BURNCLOUD_API_PARAMS, BurnCloudConfig
from .cohere_config import COHERE_API_PARAMS, CohereConfig
from .cometapi_config import COMETAPI_API_PARAMS, CometAPIConfig
from .crynux_config import CRYNUX_API_PARAMS, CrynuxConfig
Expand Down Expand Up @@ -93,6 +94,8 @@
'SAMBA_CLOUD_API_PARAMS',
'TogetherAIConfig',
'TOGETHERAI_API_PARAMS',
'BurnCloudConfig',
'BURNCLOUD_API_PARAMS',
'CohereConfig',
'COHERE_API_PARAMS',
'CometAPIConfig',
Expand Down
70 changes: 70 additions & 0 deletions camel/configs/burncloud_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
from typing import Optional, Sequence, Union

from camel.configs.base_config import BaseConfig
from camel.types import NotGiven


class BurnCloudConfig(BaseConfig):
r"""Defines parameters for BurnCloud's OpenAI-compatible chat completions.

Reference: https://docs.burncloud.com/books/api

Args:
temperature (float, optional): Sampling temperature to use, between
:obj:`0` and :obj:`2`. Higher values make the output more random,
while lower values make it more focused and deterministic.
top_p (float, optional): An alternative to sampling with temperature,
called nucleus sampling, where the model considers the results of
the tokens with top_p probability mass.
n (int, optional): How many chat completion choices to generate for
each input message.
response_format (object, optional): Response schema enforced by the
model. Setting to {"type": "json_object"} enables JSON mode.
stream (bool, optional): If True, partial deltas will be sent as
server-sent events while tokens stream back.
stop (str or list, optional): Up to :obj:`4` sequences where the API
will stop generating further tokens.
max_tokens (int, optional): Maximum number of tokens to generate in
the chat completion. Total input + output tokens must stay within
the model context window.
presence_penalty (float, optional): Number between :obj:`-2.0` and
:obj:`2.0`. Positive values penalize new tokens based on their
appearance so far, encouraging new topics.
frequency_penalty (float, optional): Number between :obj:`-2.0` and
:obj:`2.0`. Positive values penalize new tokens based on existing
frequency, reducing repetition.
user (str, optional): Unique identifier for the end-user, useful for
abuse monitoring.
tools (list[FunctionTool], optional): Tool definitions the model can
call. Currently supports function tools.
tool_choice (Union[dict[str, str], str], optional): Controls which, if
any, tool gets invoked by the model.
"""

temperature: Optional[float] = None
top_p: Optional[float] = None
n: Optional[int] = None
stream: Optional[bool] = None
stop: Optional[Union[str, Sequence[str], NotGiven]] = None
max_tokens: Optional[Union[int, NotGiven]] = None
presence_penalty: Optional[float] = None
response_format: Optional[Union[dict, NotGiven]] = None
frequency_penalty: Optional[float] = None
user: Optional[str] = None
tool_choice: Optional[Union[dict[str, str], str]] = None


BURNCLOUD_API_PARAMS = {param for param in BurnCloudConfig.model_fields.keys()}
2 changes: 2 additions & 0 deletions camel/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from .azure_openai_model import AzureOpenAIModel
from .base_audio_model import BaseAudioModel
from .base_model import BaseModelBackend
from .burncloud_model import BurnCloudModel
from .cohere_model import CohereModel
from .cometapi_model import CometAPIModel
from .crynux_model import CrynuxModel
Expand Down Expand Up @@ -66,6 +67,7 @@
'OpenRouterModel',
'AzureOpenAIModel',
'AnthropicModel',
'BurnCloudModel',
'AMDModel',
'MistralModel',
'GroqModel',
Expand Down
76 changes: 76 additions & 0 deletions camel/models/burncloud_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
import os
from typing import Any, Dict, Optional, Union

from camel.configs import BurnCloudConfig
from camel.models.openai_compatible_model import OpenAICompatibleModel
from camel.types import ModelType
from camel.utils import BaseTokenCounter, api_keys_required


class BurnCloudModel(OpenAICompatibleModel):
r"""OpenAI-compatible backend for the BurnCloud API gateway.

Args:
model_type (Union[ModelType, str]): Target model identifier supported
by BurnCloud, e.g., ``gpt-4o`` or ``deepseek-reasoner``.
model_config_dict (Optional[Dict[str, Any]], optional): Request payload
overrides. Defaults to :obj:`BurnCloudConfig().as_dict()`.
api_key (Optional[str], optional): BurnCloud API key. If omitted,
:obj:`BURNCLOUD_API_KEY` from the environment will be used.
url (Optional[str], optional): Endpoint base URL. Defaults to
``https://ai.burncloud.com/v1`` or ``BURNCLOUD_API_BASE_URL`` when
provided.
token_counter (Optional[BaseTokenCounter], optional): Token counter to
associate with the model. Falls back to :obj:`OpenAITokenCounter`
inside :class:`OpenAICompatibleModel` if not provided.
timeout (Optional[float], optional): Timeout in seconds for API calls.
Defaults to ``MODEL_TIMEOUT`` env var or ``180`` seconds.
max_retries (int, optional): Maximum retry attempts for failed calls.
Defaults to ``3``.
**kwargs (Any): Extra keyword arguments forwarded to the underlying
OpenAI-compatible client.
"""

@api_keys_required([('api_key', 'BURNCLOUD_API_KEY')])
def __init__(
self,
model_type: Union[ModelType, str],
model_config_dict: Optional[Dict[str, Any]] = None,
api_key: Optional[str] = None,
url: Optional[str] = None,
token_counter: Optional[BaseTokenCounter] = None,
timeout: Optional[float] = None,
max_retries: int = 3,
**kwargs: Any,
) -> None:
if model_config_dict is None:
model_config_dict = BurnCloudConfig().as_dict()
api_key = api_key or os.environ.get('BURNCLOUD_API_KEY')
url = url or os.environ.get(
'BURNCLOUD_API_BASE_URL', 'https://ai.burncloud.com/v1'
)
timeout = timeout or float(os.environ.get('MODEL_TIMEOUT', 180))

super().__init__(
model_type=model_type,
model_config_dict=model_config_dict,
api_key=api_key,
url=url,
token_counter=token_counter,
timeout=timeout,
max_retries=max_retries,
**kwargs,
)
2 changes: 2 additions & 0 deletions camel/models/model_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from camel.models.aws_bedrock_model import AWSBedrockModel
from camel.models.azure_openai_model import AzureOpenAIModel
from camel.models.base_model import BaseModelBackend
from camel.models.burncloud_model import BurnCloudModel
from camel.models.cohere_model import CohereModel
from camel.models.cometapi_model import CometAPIModel
from camel.models.crynux_model import CrynuxModel
Expand Down Expand Up @@ -111,6 +112,7 @@ class ModelFactory:
ModelPlatformType.QIANFAN: QianfanModel,
ModelPlatformType.CRYNUX: CrynuxModel,
ModelPlatformType.AIHUBMIX: AihubMixModel,
ModelPlatformType.BURNCLOUD: BurnCloudModel,
}

@staticmethod
Expand Down
6 changes: 6 additions & 0 deletions camel/types/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,7 @@ class ModelPlatformType(Enum):
NEBIUS = "nebius"
COMETAPI = "cometapi"
OPENROUTER = "openrouter"
BURNCLOUD = "burncloud"
OLLAMA = "ollama"
LITELLM = "litellm"
LMSTUDIO = "lmstudio"
Expand Down Expand Up @@ -1836,6 +1837,11 @@ def is_openrouter(self) -> bool:
r"""Returns whether this platform is openrouter."""
return self is ModelPlatformType.OPENROUTER

@property
def is_burncloud(self) -> bool:
r"""Returns whether this platform is BurnCloud."""
return self is ModelPlatformType.BURNCLOUD

@property
def is_lmstudio(self) -> bool:
r"""Returns whether this platform is lmstudio."""
Expand Down
2 changes: 2 additions & 0 deletions camel/utils/commons.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
key_way = "https://www.klavis.ai/docs"
elif env_var_name == 'XAI_API_KEY':
key_way = "https://api.x.ai/v1"
elif env_var_name == 'BURNCLOUD_API_KEY':
key_way = "https://ai.burncloud.com/v1"

if missing_keys:
raise ValueError(
Expand Down
41 changes: 41 additions & 0 deletions docs/key_modules/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ CAMEL supports a wide range of models, including [OpenAI’s GPT series](https:/
| **SambaNova** | [supported models](https://docs.sambanova.ai/cloud/docs/get-started/supported-models) |
| **Ollama** | [supported models](https://ollama.com/library) |
| **OpenRouter** | [supported models](https://openrouter.ai/models) |
| **BurnCloud** | [supported models](https://ai.burncloud.com/pricing) |
| **PPIO** | [supported models](https://ppio.com/model-api/console) |
| **LiteLLM** | [supported models](https://docs.litellm.ai/docs/providers) |
| **LMStudio** | [supported models](https://lmstudio.ai/models) |
Expand Down Expand Up @@ -426,6 +427,46 @@ Integrate your favorite models into CAMEL-AI with straightforward Python calls.

</Tab>

<Tab title="BurnCloud">
Access [BurnCloud](https://www.burncloud.com) to route OpenAI-compatible requests to GPT, Claude, DeepSeek, Grok, and other hosted models:

- **Unified Endpoint**: Send standard OpenAI Chat Completions to `https://ai.burncloud.com/v1`.
- **Model Market**: Choose any model listed in the [BurnCloud Model Market](https://ai.burncloud.com/pricing), including reasoning and multimodal variants.
- **Drop-in Replacement**: Keep the same request schema, streaming, and tool-calling semantics as OpenAI clients.

```python
from camel.models import ModelFactory
from camel.types import ModelPlatformType, ModelType
from camel.configs import BurnCloudConfig
from camel.agents import ChatAgent

model = ModelFactory.create(
model_platform=ModelPlatformType.BURNCLOUD,
model_type=ModelType.GPT_4O,
model_config_dict=BurnCloudConfig(temperature=0.2).as_dict(),
)

agent = ChatAgent(
system_message="You are a helpful assistant.",
model=model
)

response = agent.step("Summarize the CAMEL AI framework in two sentences.")
print(response.msgs[0].content)
```

**Environment Variables:**
```bash
export BURNCLOUD_API_KEY="your_burncloud_api_key"
export BURNCLOUD_API_BASE_URL="https://ai.burncloud.com/v1" # Optional override
```

<Note type="info">
BurnCloud is fully OpenAI-compatible, so you can pass any supported model identifier as a plain string (e.g., `"claude-3.5-sonnet"`) even if it isn't part of the predefined enums.
</Note>

</Tab>

<Tab title="Groq">

Using [Groq](https://groq.com/)'s powerful models (e.g., Llama 3.3-70B):
Expand Down
2 changes: 2 additions & 0 deletions docs/mintlify/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
"reference/camel.configs.ollama_config",
"reference/camel.configs.openai_config",
"reference/camel.configs.openrouter_config",
"reference/camel.configs.burncloud_config",
"reference/camel.configs.ppio_config",
"reference/camel.configs.qianfan_config",
"reference/camel.configs.qwen_config",
Expand Down Expand Up @@ -335,6 +336,7 @@
"reference/camel.models.openai_compatible_model",
"reference/camel.models.openai_model",
"reference/camel.models.openrouter_model",
"reference/camel.models.burncloud_model",
"reference/camel.models.ppio_model",
"reference/camel.models.qianfan_model",
"reference/camel.models.qwen_model",
Expand Down
41 changes: 41 additions & 0 deletions docs/mintlify/key_modules/models.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ CAMEL supports a wide range of models, including [OpenAI’s GPT series](https:/
| **SambaNova** | [supported models](https://docs.sambanova.ai/cloud/docs/get-started/supported-models) |
| **Ollama** | [supported models](https://ollama.com/library) |
| **OpenRouter** | [supported models](https://openrouter.ai/models) |
| **BurnCloud** | [supported models](https://ai.burncloud.com/pricing) |
| **PPIO** | [supported models](https://ppio.com/model-api/console) |
| **LiteLLM** | [supported models](https://docs.litellm.ai/docs/providers) |
| **LMStudio** | [supported models](https://lmstudio.ai/models) |
Expand Down Expand Up @@ -426,6 +427,46 @@ Integrate your favorite models into CAMEL-AI with straightforward Python calls.

</Tab>

<Tab title="BurnCloud">
Access [BurnCloud](https://www.burncloud.com) to route OpenAI-compatible requests to GPT, Claude, DeepSeek, Grok, and other hosted models:

- **Unified Endpoint**: Send standard OpenAI Chat Completions to `https://ai.burncloud.com/v1`.
- **Model Market**: Choose any model listed in the [BurnCloud Model Market](https://ai.burncloud.com/pricing), including reasoning and multimodal variants.
- **Drop-in Replacement**: Keep the same request schema, streaming, and tool-calling semantics as OpenAI clients.

```python
from camel.models import ModelFactory
from camel.types import ModelPlatformType, ModelType
from camel.configs import BurnCloudConfig
from camel.agents import ChatAgent

model = ModelFactory.create(
model_platform=ModelPlatformType.BURNCLOUD,
model_type=ModelType.GPT_4O,
model_config_dict=BurnCloudConfig(temperature=0.2).as_dict(),
)

agent = ChatAgent(
system_message="You are a helpful assistant.",
model=model
)

response = agent.step("Summarize the CAMEL AI framework in two sentences.")
print(response.msgs[0].content)
```

**Environment Variables:**
```bash
export BURNCLOUD_API_KEY="your_burncloud_api_key"
export BURNCLOUD_API_BASE_URL="https://ai.burncloud.com/v1" # Optional override
```

<Note type="info">
BurnCloud is fully OpenAI-compatible, so you can pass any supported model identifier as a plain string (e.g., `"claude-3.5-sonnet"`) even if it isn't part of the predefined enums.
</Note>

</Tab>

<Tab title="Groq">

Using [Groq](https://groq.com/)'s powerful models (e.g., Llama 3.3-70B):
Expand Down
32 changes: 32 additions & 0 deletions docs/mintlify/reference/camel.configs.burncloud_config.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<a id="camel.configs.burncloud_config"></a>

<a id="camel.configs.burncloud_config.BurnCloudConfig"></a>

## BurnCloudConfig

```python
class BurnCloudConfig(BaseConfig):
```

Defines parameters for BurnCloud's OpenAI-compatible chat completions.

**Parameters:**

- **temperature** (float, optional): Sampling temperature between :obj:`0` and :obj:`2`. Higher values yield more random generations.
- **top_p** (float, optional): Nucleus sampling threshold that limits tokens to the specified cumulative probability mass.
- **n** (int, optional): Number of completions to generate per request.
- **response_format** (object, optional): Optional schema enforcing the output format (e.g., `{"type": "json_object"}`).
- **stream** (bool, optional): Stream partial deltas over Server-Sent Events when :obj:`True`.
- **stop** (str or list, optional): Up to four stop sequences that terminate generation.
- **max_tokens** (int, optional): Maximum tokens the model may generate for a completion.
- **presence_penalty** (float, optional): Penalizes tokens that have already appeared to encourage topic switching.
- **frequency_penalty** (float, optional): Penalizes token repetition to reduce duplicated output.
- **user** (str, optional): Identifier for the end-user to aid abuse monitoring.
- **tools** (list[FunctionTool], optional): Function tool definitions the model may call.
- **tool_choice** (Union[dict[str, str], str], optional): Forces how tools should be invoked (e.g., `"none"`, `"auto"`, or a specific function name).

<a id="camel.configs.burncloud_config.BURNCLOUD_API_PARAMS"></a>

## BURNCLOUD_API_PARAMS

A convenience set containing every configurable field defined on :class:`BurnCloudConfig`.
Loading
Loading