Meta Model API
| Property | Details |
|---|---|
| Description | Meta's Model API provides access to Meta's Muse Spark family of reasoning models. |
| Provider Route on LiteLLM | meta/ |
| Supported Endpoints | /chat/completions, /responses |
| API Reference | Meta Model API Reference ↗ |
Required Variables​
Environment Variables
os.environ["META_API_KEY"] = "" # your Meta Model API key
Requests go to https://api.meta.ai/v1 by default. Set META_API_BASE to override the API base.
Supported Models​
info
We actively maintain the list of models, pricing, token window, etc. here.
| Model ID | Input context length | Input Modalities | Output Modalities |
|---|---|---|---|
muse-spark-1.1 | 1M | Text, Image, Video, PDF | Text |
muse-spark-1.1 supports function calling, parallel function calling, structured outputs, prompt caching, web search grounding, and reasoning via reasoning_effort ("minimal" through "xhigh").
Usage - LiteLLM Python SDK​
Non-streaming​
Meta Model API Non-streaming Completion
import os
import litellm
from litellm import completion
os.environ["META_API_KEY"] = "" # your Meta Model API key
messages = [{"content": "Hello, how are you?", "role": "user"}]
response = completion(model="meta/muse-spark-1.1", messages=messages)
Streaming​
Meta Model API Streaming Completion
import os
import litellm
from litellm import completion
os.environ["META_API_KEY"] = "" # your Meta Model API key
messages = [{"content": "Hello, how are you?", "role": "user"}]
response = completion(
model="meta/muse-spark-1.1",
messages=messages,
stream=True
)
for chunk in response:
print(chunk)
Reasoning Effort​
muse-spark-1.1 accepts reasoning_effort values "minimal", "low", "medium", "high", and "xhigh".
Meta Model API Reasoning Effort
import os
import litellm
from litellm import completion
os.environ["META_API_KEY"] = "" # your Meta Model API key
messages = [{"content": "What is 15% of 2840?", "role": "user"}]
response = completion(
model="meta/muse-spark-1.1",
messages=messages,
reasoning_effort="xhigh"
)
print(response.choices[0].message.content)
print(response.usage.completion_tokens_details.reasoning_tokens)
Function Calling​
Meta Model API Function Calling
import os
import litellm
from litellm import completion
os.environ["META_API_KEY"] = "" # your Meta Model API key
messages = [{"content": "What's the weather like in San Francisco?", "role": "user"}]
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": ["celsius", "fahrenheit"]
}
},
"required": ["location"]
}
}
}
]
response = completion(
model="meta/muse-spark-1.1",
messages=messages,
tools=tools,
tool_choice="auto"
)
print(response.choices[0].message.tool_calls)
Usage - LiteLLM Proxy​
Add the following to your LiteLLM Proxy configuration file:
config.yaml
model_list:
- model_name: muse-spark-1.1
litellm_params:
model: meta/muse-spark-1.1
api_key: os.environ/META_API_KEY
Start your LiteLLM Proxy server:
Start LiteLLM Proxy
litellm --config config.yaml
# RUNNING on http://0.0.0.0:4000
- OpenAI SDK
- LiteLLM SDK
- cURL
Meta Model API via Proxy - Non-streaming
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:4000", # Your proxy URL
api_key="your-proxy-api-key" # Your proxy API key
)
response = client.chat.completions.create(
model="muse-spark-1.1",
messages=[{"role": "user", "content": "Write a short poem about AI."}],
reasoning_effort="minimal"
)
print(response.choices[0].message.content)
Meta Model API via Proxy - Streaming
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:4000", # Your proxy URL
api_key="your-proxy-api-key" # Your proxy API key
)
response = client.chat.completions.create(
model="muse-spark-1.1",
messages=[{"role": "user", "content": "Write a short poem about AI."}],
stream=True
)
for chunk in response:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="")
Meta Model API via Proxy - LiteLLM SDK
import litellm
response = litellm.completion(
model="litellm_proxy/muse-spark-1.1",
messages=[{"role": "user", "content": "Write a short poem about AI."}],
api_base="http://localhost:4000",
api_key="your-proxy-api-key"
)
print(response.choices[0].message.content)
Meta Model API via Proxy - cURL
curl http://localhost:4000/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-proxy-api-key" \
-d '{
"model": "muse-spark-1.1",
"messages": [{"role": "user", "content": "Write a short poem about AI."}],
"reasoning_effort": "minimal"
}'