Skip to content

Commit 5aae56e

Browse files
authored
Merge pull request #1820 from cmodi-meta/llama-api-support
Add Llama API Support
2 parents 2f0c7fb + d239e53 commit 5aae56e

File tree

7 files changed

+30
-0
lines changed

7 files changed

+30
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates
2+
llm:
3+
api_type: llama_api
4+
base_url: "https://api.llama.com/compat/v1/"
5+
api_key: "YOUR_API_KEY"
6+
model: "Llama-3.3-70B-Instruct"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates
2+
llm:
3+
api_type: llama_api
4+
base_url: "https://api.llama.com/compat/v1/"
5+
api_key: "YOUR_API_KEY"
6+
model: "Llama-3.3-8B-Instruct"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates
2+
llm:
3+
api_type: llama_api
4+
base_url: "https://api.llama.com/compat/v1/"
5+
api_key: "YOUR_API_KEY"
6+
model: "Llama-4-Scout-17B-16E-Instruct-FP8"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates
2+
llm:
3+
api_type: llama_api
4+
base_url: "https://api.llama.com/compat/v1/"
5+
api_key: "YOUR_API_KEY"
6+
model: "Llama-4-Maverick-17B-128E-Instruct-FP8"

metagpt/configs/llm_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class LLMType(Enum):
4343
OPENROUTER_REASONING = "openrouter_reasoning"
4444
BEDROCK = "bedrock"
4545
ARK = "ark" # https://www.volcengine.com/docs/82379/1263482#python-sdk
46+
LLAMA_API = "llama_api"
4647

4748
def __missing__(self, key):
4849
return self.OPENAI

metagpt/provider/openai_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
LLMType.DEEPSEEK,
5353
LLMType.SILICONFLOW,
5454
LLMType.OPENROUTER,
55+
LLMType.LLAMA_API,
5556
]
5657
)
5758
class OpenAILLM(BaseLLM):

metagpt/utils/token_counter.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@
113113
"doubao-pro-128k-240515": {"prompt": 0.0007, "completion": 0.0013},
114114
"llama3-70b-llama3-70b-instruct": {"prompt": 0.0, "completion": 0.0},
115115
"llama3-8b-llama3-8b-instruct": {"prompt": 0.0, "completion": 0.0},
116+
"llama-4-Scout-17B-16E-Instruct-FP8" : {"prompt": 0.0, "completion": 0.0}, # start, for Llama API
117+
"llama-4-Maverick-17B-128E-Instruct-FP8": {"prompt": 0.0, "completion": 0.0},
118+
"llama-3.3-8B-Instruct": {"prompt": 0.0, "completion": 0.0},
119+
"llama-3.3-70B-Instruct": {"prompt": 0.0, "completion": 0.0}, # end, for Llama API
116120
}
117121

118122

0 commit comments

Comments
 (0)