Meta Model API

Start here

Overview
Quickstart
Authentication
Models
SDKs and libraries
Pricing and rate limits

Capabilities

Tool calling
Tool search
Search grounding
Image understanding
Video understanding
File handling
Reasoning
Structured output
Prompt caching
Token counting

Protocols

Choosing an API
Responses API
Chat Completions API
Messages API

Cookbook

All recipes
API fundamentals
Agent patterns
Use cases
Building with Muse Code

Muse Code

Overview
Authentication and billing
Permissions and safety
Working with the agent
Configuration and context
Extending and automating

Muse Glimmer

Overview
Get the model
Prompting guide
Quantization
Speculative decoding
Run inference
Customization

Agent guides

Coding agents
Agent frameworks
Computer use

API reference

Introduction
Error handling
Status
Responses
Chat completions
Messages
Files
Models

Log in

--- meta: title: SDKs and libraries description: Use the OpenAI SDK (Python or TypeScript) or the Anthropic SDK with Meta Model API. No custom client required. keywords: SDKs, OpenAI SDK, Anthropic SDK, Python SDK, TypeScript SDK, Messages API, libraries cms: alias: /model-api/docs/sdks target: aidmc --- # SDKs and libraries Build with the tools you already run. **Meta Model API** works with the OpenAI SDK and the Anthropic SDK — no custom client to learn. Point the OpenAI SDK at the Model API base URL for [Responses](/docs/protocols/responses) and [Chat Completions](/docs/protocols/chat-completions), or point the Anthropic SDK at Model API for the [Messages](/docs/protocols/messages) format. Any OpenAI-compatible SDK, HTTP client, or framework — such as LangChain, LlamaIndex, or Vercel AI SDK — works with Model API too. ## Supported features {#supported-features} Through the OpenAI SDK you can call: - [Responses API](/docs/protocols/responses) (`client.responses.create()`) - [Chat completions](/docs/protocols/chat-completions) (`client.chat.completions.create()`) - [Search grounding](/docs/search-grounding) (via Responses API) - [Image understanding](/docs/image-understanding) (vision) - [Video and audio understanding](/docs/video-understanding) (Responses API and Chat Completions) - [Structured output](/docs/structured-output) (`response_format`) - [Function calling / tool use](/docs/tool-calling) - [File uploads](/docs/file-handling) (`client.files.create()`) - [Streaming](/docs/protocols/chat-completions#streaming) - [Temperature and sampling parameters](/docs/protocols/chat-completions#parameters) - [Model selection](/docs/protocols/chat-completions#parameters) ## Python {#python} Install the package: ```shell pip install openai ``` Send a request: ```python title="Python (OpenAI SDK)" import os from openai import OpenAI client = OpenAI( api_key=os.environ["MODEL_API_KEY"], base_url="https://api.meta.ai/v1", ) response = client.responses.create( model="muse-spark-1.1", input="Explain mixture-of-experts in two sentences.", ) print(response.output_text) ``` ## TypeScript {#typescript} Install the package: ```shell npm install openai ``` Send a request: ```typescript title="TypeScript (OpenAI SDK)" import OpenAI from "openai"; const client = new OpenAI({ apiKey: process.env.MODEL_API_KEY, baseURL: "https://api.meta.ai/v1", }); const response = await client.responses.create({ model: "muse-spark-1.1", input: "Explain mixture-of-experts in two sentences.", }); console.log(response.output_text); ``` ## Anthropic SDK {#anthropic} Use the Anthropic SDK for Model API's [Messages API](/docs/protocols/messages). Set the base host to `https://api.meta.ai` — the SDK appends `/v1/messages` — and pass your Model API key as a bearer token: ```python title="Python (Anthropic SDK)" import os from anthropic import Anthropic client = Anthropic( base_url="https://api.meta.ai", auth_token=os.environ["MODEL_API_KEY"], ) message = client.messages.create( model="muse-spark-1.1", max_tokens=1024, messages=[{"role": "user", "content": "Explain mixture-of-experts in two sentences."}], ) print(message.content[0].text) ``` See the [Messages API guide](/docs/protocols/messages) for the full request and response shape. ## Authentication {#authentication} The OpenAI SDK looks for `OPENAI_API_KEY` by default, not `MODEL_API_KEY`. Pass your Model API key explicitly when you create the client: ```python title="Python (OpenAI SDK)" client = OpenAI( api_key=os.environ["MODEL_API_KEY"], base_url="https://api.meta.ai/v1", ) ``` See [Authentication](/docs/authentication) for details on creating and managing API keys.

SDKs and libraries

Build with the tools you already run. Meta Model API works with the OpenAI SDK and the Anthropic SDK — no custom client to learn. Point the OpenAI SDK at the Model API base URL for Responses and Chat Completions, or point the Anthropic SDK at Model API for the Messages format. Any OpenAI-compatible SDK, HTTP client, or framework — such as LangChain, LlamaIndex, or Vercel AI SDK — works with Model API too.

Supported features

Through the OpenAI SDK you can call:
  • •Responses API (client.responses.create())
  • •Chat completions (client.chat.completions.create())
  • •Search grounding (via Responses API)
  • •Image understanding (vision)
  • •Video and audio understanding (Responses API and Chat Completions)
  • •Structured output (response_format)
  • •Function calling / tool use
  • •File uploads (client.files.create())
  • •Streaming
  • •Temperature and sampling parameters
  • •Model selection

Python

Install the package:
Shell
Send a request:
Python (OpenAI SDK)

TypeScript

Install the package:
Shell
Send a request:
TypeScript (OpenAI SDK)

Anthropic SDK

Use the Anthropic SDK for Model API's Messages API. Set the base host to https://api.meta.ai — the SDK appends /v1/messages — and pass your Model API key as a bearer token:
Python (Anthropic SDK)
See the Messages API guide for the full request and response shape.

Authentication

The OpenAI SDK looks for OPENAI_API_KEY by default, not MODEL_API_KEY. Pass your Model API key explicitly when you create the client:
Python (OpenAI SDK)
See Authentication for details on creating and managing API keys.
Was this page helpful?
Supported features
Python
TypeScript
Anthropic SDK
Authentication