Home › Meta Model API course: 3 beginner lessons
Meta Model API course: 3 beginner lessons
What it does
The Meta Model API gives your code self-serve access to Meta's Muse models (Muse Wonder, Muse Spark, Muse Image and more). It works with the OpenAI SDK, so most code only needs a new base URL and key.
Who it's for: Developers who want Meta's Muse models in their own app, agent or coding tool.
Made by Meta.
Sign up and log in
- Open the Model API dashboard at dev.meta.ai and sign up.
- Generate an API key (one click in the dashboard).
- Export it as an environment variable named MODEL_API_KEY.
- Install the OpenAI SDK (pip install openai).
- Point it at base_url="https://api.meta.ai/v1" and pass your key; the OpenAI SDK doesn't read MODEL_API_KEY by itself.
Per million tokens on the Meta Model API page: muse-spark-1.3 US$1.25 input / US$4.25 output, muse-wonder-1.0 US$4.00 / US$20.00, and contributor models US$0.10 / US$0.20 (these are used to improve Meta's products). Muse Image is US$0.01 per image.
Lesson 1: Get a key and make your first Muse Spark call
Meta Model API speaks the same Responses API format as the OpenAI SDK, so your first call is a few lines once the base URL and key are set..
- Create a key in the Model API dashboard and export MODEL_API_KEY.
- pip install openai
- Create the client: OpenAI(base_url="https://api.meta.ai/v1", api_key=os.environ["MODEL_API_KEY"]).
- Call client.responses.create(model="muse-spark-1.3", input="…").
- Print the text of the reply, then try a harder prompt.
Lesson 2: Get current, cited answers with search grounding
Search grounding lets the model search the live web and answer with inline citations, with no search index or retrieval pipeline of your own..
- Use client.responses.create (search grounding only works on the Responses API, not Chat Completions).
- Add tools=[{"type": "web_search"}].
- The model decides whether a search is needed and runs it on Meta's side.
- Read the url_citation annotations: each points at the text it supports and the source URL.
- Turn the citations into footnotes or links for your users.
Lesson 3: Generate and edit images with Muse Image
Muse Image creates and edits images in a conversation: describe an image, get it back, then refine it turn by turn, or edit an existing image and keep the rest intact..
- Call client.responses.create(model="muse-image-1.0", input="…") with your description.
- Read the image from the response output.
- Send a follow-up in the same conversation to refine it (colours, framing, text).
- To edit, send an existing image with an instruction; it changes only what you ask.
- For one-off jobs, use the /v1/images/generations and /v1/images/edits endpoints.
Sources
Also: All Meta products · Meta AI course · Meta AI features and prices · All tutorials
New model: Muse Ember (muse-ember-1.0), $0.10 / $0.50 per 1M tokens.