mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-09-03 06:35:22 +08:00
Add Llama API Support
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
llm:
|
||||
api_type: llamaapi
|
||||
base_url: "https://api.llama.com/compat/v1/"
|
||||
api_key: "YOUR_API_KEY"
|
||||
model: llama-4-Maverick-17B-128E-Instruct-FP8
|
||||
@@ -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
|
||||
|
||||
@@ -52,6 +52,7 @@ from metagpt.utils.token_counter import (
|
||||
LLMType.DEEPSEEK,
|
||||
LLMType.SILICONFLOW,
|
||||
LLMType.OPENROUTER,
|
||||
LLMType.LLAMA_API,
|
||||
]
|
||||
)
|
||||
class OpenAILLM(BaseLLM):
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user