---
meta:
title: Get started with Meta Model API
description: Wire up Meta Model API in under 5 minutes — directly via curl, an SDK, or your coding agent.
keywords: Meta Model API, OpenAI SDK, Anthropic SDK, Muse Spark, coding agents, Claude Code, OpenCode, quickstart
cms:
alias: /model-api/docs/getting-started/overview
target: aidmc
---
# Get started with Meta Model API
**Meta Model API** lets you build with Muse Spark using the tools you already run. It is drop-in compatible with the OpenAI SDK, the Anthropic SDK, and agent CLIs like **OpenCode** and **Claude Code**. Point your client at the Model API base URL, set your key, and keep the rest of your code.
You get agent-ready primitives out of the box: parallel tool calls, streamed tool-call arguments, reasoning that carries across turns, and a 1M-token context window. Choose to build with [Responses API](/docs/features/responses), [Chat Completions API](/docs/features/chat-completion), or [Messages API](/docs/features/messages); you get the same models, same auth, and same cost per token across all three, with Responses exposing the full feature set for agentic workflows. Pick the format your code already speaks.
| | |
| --- | --- |
| **Base URL** | `https://api.meta.ai/v1` |
| **Model** | `muse-spark-1.1` |
| **Context window** | 1,048,576 tokens |
| **Auth** | Bearer token (`MODEL_API_KEY`) |
| **Pricing** | Pay-as-you-go; see [Pricing and rate limits](/docs/getting-started/pricing-rate-limits) |
## Features {#features}
Muse Spark ships with everything you need to go from prompt to production:
* [Search grounding](/docs/features/search-grounding): Get real-time answers with inline citations
* [Image understanding](/docs/features/image-understanding): Read photos, charts, docs, and screenshots
* [Video understanding](/docs/features/video-understanding): Summarize clips and ask questions about what's in them
* [Structured output](/docs/features/structured-output): Return valid JSON that matches your schema every time
* [Tool calling](/docs/features/tool-calling): Connect the model to your APIs and services
* [Reasoning](/docs/features/reasoning): Dial reasoning effort up or down per request
* [Files API](/docs/features/files): Upload once, reference by ID across requests
* [Prompt caching](/docs/features/prompt-caching): Cache repeated prefixes to cut latency and cost
---
## Compatibility {#compatibility}
Wire Model API into your existing [coding harness](/docs/guides/coding-agents) or [SDK](/docs/getting-started/sdks). Choose the request format you already use:
* [Responses API](/docs/features/responses): OpenAI SDK and OpenAI-compatible stacks, plus reasoning replay across turns, search grounding, and file inputs
* [Chat Completions](/docs/features/chat-completion): OpenAI SDK, **OpenCode**, LangChain, LlamaIndex, Vercel AI SDK, and other OpenAI-compatible stacks
* [Messages](/docs/features/messages): Anthropic SDK, **Claude Code**, and other Anthropic Messages-compatible tools
---
## Set your API key {#api-key}
Get an API key from [Model API dashboard](/) → **API keys** → **Create API key**. Store it as an environment variable so it stays out of your code — the coding agent setup and SDK examples below both read `MODEL_API_KEY` from the environment.
**macOS / Linux:**
```shell
export MODEL_API_KEY="your-api-key-here"
```
**Windows (PowerShell):**
```powershell
$env:MODEL_API_KEY = "your-api-key-here"
```
To persist the variable across terminal sessions, add the export line to your `~/.bashrc` or `~/.zshrc` (macOS/Linux), or set it through **System > Environment Variables** (Windows).
> [!NOTE]
> Learn more about key storage best practices in the [Authentication guide](/docs/getting-started/authentication).
---
## Use with your coding agent {#agent-setup}
Any harness that supports an OpenAI-compatible or custom provider plugs into Model API via [Responses](/docs/features/responses) or [Chat Completions](/docs/features/chat-completion). Anthropic-format harnesses like **Claude Code** plug in via the [Messages API](/docs/features/messages) instead, pointed at `https://api.meta.ai` with your `MODEL_API_KEY`. Most tools ask for three values: the base URL `https://api.meta.ai/v1`, your `MODEL_API_KEY`, and the model ID `muse-spark-1.1`.
### Two-step setup {#two-step-setup}
**Step 1: Get an API key.** Grab one from the [Model API dashboard](/) and export it as `MODEL_API_KEY` (see [Set your API key](#api-key) above).
**Step 2: Paste this into your coding agent.** OpenCode and other self-configuring agents (Goose, Roo, and more) register a provider straight from a prompt. In a session running on your current model, paste:
```text
Add a new provider to my config for Meta Model API:
- Provider key: "meta", display name "Meta Model API"
- npm adapter: "@ai-sdk/openai" (targets the Responses API)
- Base URL: https://api.meta.ai/v1
- Model: "muse-spark-1.1"
- Reasoning: true, with reasoningEffort "high", reasoningSummary "auto", and include ["reasoning.encrypted_content"]
- Limits: context 1048576, output 131072
- Modalities: input ["text", "image", "pdf", "video"], output ["text"]
- Read the key from the MODEL_API_KEY environment variable
```
Select `muse-spark-1.1` and start coding. That's it. For **Codex**, **Claude Code**, or hand-written config, see the [full coding agents guide](/docs/guides/coding-agents).
### OpenCode config {#opencode}
Prefer to edit the config yourself? Manual setup follows the same shape everywhere: register a provider, point it at the base URL, and select `muse-spark-1.1`. Here's the complete block for **OpenCode**, a popular coding CLI.
Add to your `opencode.json` (global at `~/.config/opencode/opencode.json` or per-project). Use the `@ai-sdk/openai` adapter, which drives Muse Spark over the Responses API — this enables native multimodal input (images and PDFs) and replays encrypted reasoning across turns, so the model retains its prior reasoning during tool loops:
```json
{
"provider": {
"meta": {
"name": "Meta Model API",
"npm": "@ai-sdk/openai",
"options": {
"baseURL": "https://api.meta.ai/v1"
},
"models": {
"muse-spark-1.1": {
"name": "muse-spark-1.1",
"reasoning": true,
"limit": {
"context": 1048576,
"output": 131072
},
"modalities": {
"input": ["text", "image", "pdf", "video"],
"output": ["text"]
},
"options": {
"reasoningEffort": "high",
"reasoningSummary": "auto",
"include": ["reasoning.encrypted_content"]
}
}
}
}
}
}
```
Run `/connect`, select the `meta` provider, and enter your API key when prompted. Restart **OpenCode** and select Muse Spark.
> [!NOTE]
> The `include: ["reasoning.encrypted_content"]` setting is what carries Muse Spark's reasoning across turns. Without it, the model reasons from scratch each turn and can lose the thread in multi-step loops. If you don't need reasoning continuity or native PDF input, the simpler `@ai-sdk/openai-compatible` adapter works as a fallback. See the [full coding agents guide](/docs/guides/coding-agents#opencode-config) for both adapters and the tradeoffs.
### Any OpenAI-compatible tool {#any-tool}
If your tool has a "base URL" or "API base" field, set it to `https://api.meta.ai/v1` and use `muse-spark-1.1` as the model. This works for LangChain, LlamaIndex, Vercel AI SDK, Continue, and most agentic frameworks.
---
## Make your first call {#first-call}
### Send the request {#send-request}
Prefer to call the API directly? You'll need a [Model API account](/), your `MODEL_API_KEY` set from [Set your API key](#api-key) above, and either `curl` or Python 3.9+ / Node.js 18+. Then pick your path:
#### curl
```shell
curl -X POST "https://api.meta.ai/v1/responses" \
-H "Authorization: Bearer $MODEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "muse-spark-1.1",
"input": "What is the capital of France?"
}'
```
> [!NOTE]
> Windows users: use `%MODEL_API_KEY%` (cmd) or `$env:MODEL_API_KEY` (PowerShell) instead of `$MODEL_API_KEY`.
#### Python (OpenAI SDK)
```shell
pip install openai
```
```python
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.meta.ai/v1",
api_key=os.environ["MODEL_API_KEY"],
)
response = client.responses.create(
model="muse-spark-1.1",
input="What is the capital of France?",
)
print(response.model_dump_json(indent=2))
```
#### TypeScript (OpenAI SDK)
```typescript
import OpenAI from 'openai';
const apiKey = process.env.MODEL_API_KEY;
if (!apiKey) {
throw new Error('MODEL_API_KEY is not set');
}
const client = new OpenAI({
baseURL: 'https://api.meta.ai/v1',
apiKey,
});
const response = await client.responses.create({
model: 'muse-spark-1.1',
input: 'What is the capital of France?',
});
console.log(JSON.stringify(response, null, 2));
```
> [!NOTE]
> The OpenAI SDK doesn't auto-read `MODEL_API_KEY`. Always pass `api_key` explicitly or set `OPENAI_API_KEY` to your Model API key. See [Authentication](/docs/getting-started/authentication) for details.
A successful call returns generated text plus usage, status, and other response metadata.
---
## Next steps
- Start from runnable, end-to-end recipes in the [Cookbook](/docs/getting-started/cookbook).
- Configure **OpenCode** and other harnesses in the [full coding agents guide](/docs/guides/coding-agents).
- Add live web access with [search grounding](/docs/features/search-grounding).
- Verify params and response shapes in the [API reference](/docs/api-reference/responses/create-response).
Get started with Meta Model API
Meta Model API lets you build with Muse Spark using the tools you already run. It is drop-in compatible with the OpenAI SDK, the Anthropic SDK, and agent CLIs like OpenCode and Claude Code. Point your client at the Model API base URL, set your key, and keep the rest of your code.You get agent-ready primitives out of the box: parallel tool calls, streamed tool-call arguments, reasoning that carries across turns, and a 1M-token context window. Choose to build with Responses API, Chat Completions API, or Messages API; you get the same models, same auth, and same cost per token across all three, with Responses exposing the full feature set for agentic workflows. Pick the format your code already speaks.
|
|
|---|
Base URL | https://api.meta.ai/v1
|
Model | muse-spark-1.1
|
Context window | 1,048,576 tokens |
Auth | Bearer token (MODEL_API_KEY) |
Pricing | |
Muse Spark ships with everything you need to go from prompt to production:Wire Model API into your existing coding harness or SDK. Choose the request format you already use:- •Responses API: OpenAI SDK and OpenAI-compatible stacks, plus reasoning replay across turns, search grounding, and file inputs
- •Chat Completions: OpenAI SDK, OpenCode, LangChain, LlamaIndex, Vercel AI SDK, and other OpenAI-compatible stacks
- •Messages: Anthropic SDK, Claude Code, and other Anthropic Messages-compatible tools
Get an API key from Model API dashboard → API keys → Create API key. Store it as an environment variable so it stays out of your code — the coding agent setup and SDK examples below both read MODEL_API_KEY from the environment.macOS / Linux:Windows (PowerShell):To persist the variable across terminal sessions, add the export line to your ~/.bashrc or ~/.zshrc (macOS/Linux), or set it through System > Environment Variables (Windows).Use with your coding agent
Any harness that supports an OpenAI-compatible or custom provider plugs into Model API via Responses or Chat Completions. Anthropic-format harnesses like Claude Code plug in via the Messages API instead, pointed at https://api.meta.ai with your MODEL_API_KEY. Most tools ask for three values: the base URL https://api.meta.ai/v1, your MODEL_API_KEY, and the model ID muse-spark-1.1.Step 1: Get an API key. Grab one from the Model API dashboard and export it as MODEL_API_KEY (see Set your API key above).Step 2: Paste this into your coding agent. OpenCode and other self-configuring agents (Goose, Roo, and more) register a provider straight from a prompt. In a session running on your current model, paste:Select muse-spark-1.1 and start coding. That's it. For Codex, Claude Code, or hand-written config, see the full coding agents guide.Prefer to edit the config yourself? Manual setup follows the same shape everywhere: register a provider, point it at the base URL, and select muse-spark-1.1. Here's the complete block for OpenCode, a popular coding CLI.Add to your opencode.json (global at ~/.config/opencode/opencode.json or per-project). Use the @ai-sdk/openai adapter, which drives Muse Spark over the Responses API — this enables native multimodal input (images and PDFs) and replays encrypted reasoning across turns, so the model retains its prior reasoning during tool loops:Run /connect, select the meta provider, and enter your API key when prompted. Restart OpenCode and select Muse Spark.The include: ["reasoning.encrypted_content"] setting is what carries Muse Spark's reasoning across turns. Without it, the model reasons from scratch each turn and can lose the thread in multi-step loops. If you don't need reasoning continuity or native PDF input, the simpler @ai-sdk/openai-compatible adapter works as a fallback. See the full coding agents guide for both adapters and the tradeoffs. Any OpenAI-compatible tool
If your tool has a "base URL" or "API base" field, set it to https://api.meta.ai/v1 and use muse-spark-1.1 as the model. This works for LangChain, LlamaIndex, Vercel AI SDK, Continue, and most agentic frameworks.Prefer to call the API directly? You'll need a Model API account, your MODEL_API_KEY set from Set your API key above, and either curl or Python 3.9+ / Node.js 18+. Then pick your path:curl
Windows users: use %MODEL_API_KEY% (cmd) or $env:MODEL_API_KEY (PowerShell) instead of $MODEL_API_KEY.
Python (OpenAI SDK)
TypeScript (OpenAI SDK)
The OpenAI SDK doesn't auto-read MODEL_API_KEY. Always pass api_key explicitly or set OPENAI_API_KEY to your Model API key. See Authentication for details. A successful call returns generated text plus usage, status, and other response metadata.