diff --git a/config/examples/llamaapi-Llama-3.3-70B-Instruct.yaml b/config/examples/llamaapi-Llama-3.3-70B-Instruct.yaml new file mode 100644 index 000000000..392bbe268 --- /dev/null +++ b/config/examples/llamaapi-Llama-3.3-70B-Instruct.yaml @@ -0,0 +1,6 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates +llm: + api_type: llama_api + base_url: "https://api.llama.com/compat/v1/" + api_key: "YOUR_API_KEY" + model: "Llama-3.3-70B-Instruct" diff --git a/config/examples/llamaapi-Llama-3.3-8B-Instruct.yaml b/config/examples/llamaapi-Llama-3.3-8B-Instruct.yaml new file mode 100644 index 000000000..c63e4b5d0 --- /dev/null +++ b/config/examples/llamaapi-Llama-3.3-8B-Instruct.yaml @@ -0,0 +1,6 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates +llm: + api_type: llama_api + base_url: "https://api.llama.com/compat/v1/" + api_key: "YOUR_API_KEY" + model: "Llama-3.3-8B-Instruct" diff --git a/config/examples/llamaapi-Llama-4-Scout-17B-16E-Instruct-FP8.yaml b/config/examples/llamaapi-Llama-4-Scout-17B-16E-Instruct-FP8.yaml new file mode 100644 index 000000000..61504467b --- /dev/null +++ b/config/examples/llamaapi-Llama-4-Scout-17B-16E-Instruct-FP8.yaml @@ -0,0 +1,6 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates +llm: + api_type: llama_api + base_url: "https://api.llama.com/compat/v1/" + api_key: "YOUR_API_KEY" + model: "Llama-4-Scout-17B-16E-Instruct-FP8" diff --git a/config/examples/llamaapi-llama-4-Maverick-17B-128E-Instruct-FP8.yaml b/config/examples/llamaapi-llama-4-Maverick-17B-128E-Instruct-FP8.yaml new file mode 100644 index 000000000..9bea8a93f --- /dev/null +++ b/config/examples/llamaapi-llama-4-Maverick-17B-128E-Instruct-FP8.yaml @@ -0,0 +1,6 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates +llm: + api_type: llama_api + base_url: "https://api.llama.com/compat/v1/" + api_key: "YOUR_API_KEY" + model: "Llama-4-Maverick-17B-128E-Instruct-FP8" diff --git a/metagpt/configs/llm_config.py b/metagpt/configs/llm_config.py index 2ceef2e2a..f17904d8f 100644 --- a/metagpt/configs/llm_config.py +++ b/metagpt/configs/llm_config.py @@ -43,6 +43,7 @@ class LLMType(Enum): OPENROUTER_REASONING = "openrouter_reasoning" BEDROCK = "bedrock" ARK = "ark" # https://www.volcengine.com/docs/82379/1263482#python-sdk + LLAMA_API = "llama_api" def __missing__(self, key): return self.OPENAI diff --git a/metagpt/provider/openai_api.py b/metagpt/provider/openai_api.py index 9ed60bfe8..877bd7138 100644 --- a/metagpt/provider/openai_api.py +++ b/metagpt/provider/openai_api.py @@ -52,6 +52,7 @@ from metagpt.utils.token_counter import ( LLMType.DEEPSEEK, LLMType.SILICONFLOW, LLMType.OPENROUTER, + LLMType.LLAMA_API, ] ) class OpenAILLM(BaseLLM): diff --git a/metagpt/utils/token_counter.py b/metagpt/utils/token_counter.py index 80bdacae5..e8bf9d811 100644 --- a/metagpt/utils/token_counter.py +++ b/metagpt/utils/token_counter.py @@ -113,6 +113,10 @@ TOKEN_COSTS = { "doubao-pro-128k-240515": {"prompt": 0.0007, "completion": 0.0013}, "llama3-70b-llama3-70b-instruct": {"prompt": 0.0, "completion": 0.0}, "llama3-8b-llama3-8b-instruct": {"prompt": 0.0, "completion": 0.0}, + "llama-4-Scout-17B-16E-Instruct-FP8" : {"prompt": 0.0, "completion": 0.0}, # start, for Llama API + "llama-4-Maverick-17B-128E-Instruct-FP8": {"prompt": 0.0, "completion": 0.0}, + "llama-3.3-8B-Instruct": {"prompt": 0.0, "completion": 0.0}, + "llama-3.3-70B-Instruct": {"prompt": 0.0, "completion": 0.0}, # end, for Llama API }