baz.studio API

Remote MCP server

Let Claude, ChatGPT, Cursor, or your own agent make baz.studio videos over the Model Context Protocol, with no CLI on the machine.

baz.studio runs a remote MCP server. Any agent that speaks the Model Context Protocol can create projects, generate scenes, upload media, export, and check state, using the same engine as the web app and the baz CLI. Use it when the agent cannot run a local CLI: Claude.ai connectors, ChatGPT apps, hosted Cursor or Codex, or a server-side workflow.

Endpoint

https://baz.studio/api/mcp

Transport: Streamable HTTP (MCP 2025-03-26), stateless. Every request authenticates on its own; there is no session id to keep. Discovery metadata is at /.well-known/oauth-authorization-server and /.well-known/oauth-protected-resource.

Authenticate

Two ways, pick one.

OAuth, for connector UIs. Add the endpoint above as a custom connector in Claude.ai, ChatGPT, or another MCP client that supports OAuth 2.0 with dynamic client registration. The client registers itself, you sign in to baz.studio, and the client gets a scoped token. Scopes: project.read, project.write, generation.run, balance.read. Purchasing balance is deliberately not a scope; top up on the website.

API key, for scripts and servers. Send the key from baz auth as a header on every request.

baz auth login
# key is in ~/.bazaar/config.json
curl -s https://baz.studio/api/mcp \
  -H "content-type: application/json" \
  -H "accept: application/json, text/event-stream" \
  -H "x-api-key: $BAZ_API_KEY" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

Tools

ToolWhat it doesCosts balance
create_projectCreate a project with a name and formatno
list_projectsList the projects the user can accessno
generate_videoRun the agent on a project with a promptyes, on success
list_scenesList scenes with durations and tracksno
get_sceneFetch one scene's code and metadatano
export_videoStart a render and optionally wait for the MP4yes
upload_mediaUpload an image, video, or audio asset to a projectno
set_contextAttach brand or reference context to a projectno
get_stateCurrent project state, scenes, and the latest runno
verifyCheck a project against criteria such as duration and formatno

The tool schemas are the source of truth. Call tools/list for the current input fields.

generate_video

This is the tool that spends balance, so its rules are explicit.

  • Billed only on success. A run that completes is charged its metered cost. A run that fails, is cancelled, or stops early is not charged. Media the run generates on the way (voice, images, clips) is charged per operation as it happens.
  • Safe to retry. Pass idempotency_key. A second call with the same key returns the existing run instead of starting and billing another one.
  • Long runs. The tool waits up to timeoutMs (default 15 minutes, maximum about 28). If the run is still going when the wait ends, the tool returns the runId and the run keeps going on the server. Call get_state for the project to see the result.
  • Modes. agent is the default. agent-fast is cheaper and quicker for small edits; agent-max is for hard, multi-scene work.

Example call:

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "generate_video",
    "arguments": {
      "projectId": "<project uuid>",
      "prompt": "Add a 3 second closing scene with the words Ship it on a dark background.",
      "mode": "agent-fast",
      "idempotency_key": "closing-scene-v1"
    }
  }
}

A successful result contains runId, scenesCreated, scenesUpdated, and the agent's summary.

Typical flow

  1. create_project with the format you want (landscape, portrait, or square).
  2. set_context with the brand or reference material.
  3. upload_media for any footage or logos.
  4. generate_video with the brief. Read the summary and scenesUpdated.
  5. verify with a criteria array such as ["duration <= 60s", "portrait"].
  6. export_video when the project is right. The MP4 URL comes back when the render finishes.

Limits and notes

  • The remote server has the same free demo and balance rules as the web app. A user with no balance gets a 402 from generate_video.
  • Tool calls run as the signed-in user. There is no service account and no way to act on another user's projects.
  • The stdio server built into the CLI (baz mcp) exposes the same tool names for agents that do run locally. See baz mcp.
  • Staging mirrors production at https://staging.baz.studio/api/mcp for testing against the head of the dev branch.