Cuddler Platform API MCP

Cuddler Platform API用のリモートMCPサーバー:モデルの一覧表示、動画・画像・音声・音楽ジョブの料金確認と作成、残高の確認ができます。APIキーはBearerヘッダーで送信します。

ホスト型 MCP サーバー

npx add-mcp 'https://api.cuddler.ai/v1/mcp'

Claude Code、Codex、Cursor などにインストールできます

ドキュメント

MCP server

Connect Claude Code, Cursor, Codex and other MCP clients to the API, with your key read from an environment variable instead of written into a file.

The API is also a remote MCP server. An AI agent such as Claude Code, Cursor or Codex can list models, price and create videos, images, speech and music, follow them and read your balance as tools. Each tool runs the same endpoint as the REST API with your organization's API key: the same models, prices, holds, limits and errors.

Endpoint

TopicDetails
URLhttps://api.cuddler.ai/v1/mcp
TransportStreamable HTTP, POST only. No event stream and no session: every request gets one JSON answer.
AuthenticationAuthorization: Bearer <API key>, with a live (cud_sk_live_…) or test (cud_sk_test_…) key (Authentication)
Sign-inNone. There is no OAuth, so use a client that lets you set a request header.

Keep the key out of your files

A configuration that sends Authorization: Bearer cud_sk_live_… holds your key in plain text, and files such as .mcp.json, .cursor/mcp.json and .codex/config.toml are often committed with the project. Put the key in an environment variable named CUDDLER_API_KEY instead, and let the configuration name the variable: the file then holds no secret and can be shared.

export CUDDLER_API_KEY="cud_sk_test_..."
  • Start with a test key. It can list models, estimate prices and read the balance, but it cannot create anything or spend money (Tools).
  • Set the variable where the client is started, for example in your shell profile or from a secret manager, then restart the client: clients read it when they connect.
  • Never get a connection working by pasting the key into a file in your repository. If a key has been written into a file, a commit or a chat, revoke it (If a key leaks).

Claude Code

From the root of your project, add the server with the header in single quotes:

claude mcp add --transport http --scope project cuddler https://api.cuddler.ai/v1/mcp \
  --header 'Authorization: Bearer ${CUDDLER_API_KEY}'

The single quotes keep ${CUDDLER_API_KEY} as written, and Claude Code replaces it with the variable's value each time it connects. In double quotes your shell would replace it before Claude Code sees it, and the key itself would be saved in the file.

--scope project writes .mcp.json, which is safe to commit:

{
  "mcpServers": {
    "cuddler": {
      "type": "http",
      "url": "https://api.cuddler.ai/v1/mcp",
      "headers": {
        "Authorization": "Bearer ${CUDDLER_API_KEY}"
      }
    }
  }
}

Leave out --scope project to keep the server to yourself in this project, or use --scope user for all your projects. Claude Code then stores it in ~/.claude.json; quote the header the same way.

  • claude mcp list shows whether the server is connected. If CUDDLER_API_KEY is not set, it warns that the variable is missing, and the server answers 401.
  • Claude Code asks you to approve the servers in a project's .mcp.json before it uses them. In a session, /mcp shows the server and its tools.
  • Claude Code asks before it uses each tool for the first time, and you can tell it not to ask again. To be asked before every job and every cancellation, add ask rules to .claude/settings.json:
{
  "permissions": {
    "ask": ["mcp__cuddler__create_video", "mcp__cuddler__create_image", "mcp__cuddler__create_speech", "mcp__cuddler__create_music", "mcp__cuddler__cancel_video"]
  }
}

Cursor

Add the server to .cursor/mcp.json in your project, or to ~/.cursor/mcp.json for all your projects:

{
  "mcpServers": {
    "cuddler": {
      "url": "https://api.cuddler.ai/v1/mcp",
      "headers": {
        "Authorization": "Bearer ${env:CUDDLER_API_KEY}"
      }
    }
  }
}
  • Cursor replaces ${env:CUDDLER_API_KEY} with the variable from its environment. Set the variable in your shell profile or system environment and restart Cursor; envFile does not apply to remote servers.
  • Cursor asks for approval before it runs an MCP tool. Keep the four creates (create_video, create_image, create_speech, create_music) out of any list of tools you let run automatically.

Codex

codex mcp add cuddler --url https://api.cuddler.ai/v1/mcp --bearer-token-env-var CUDDLER_API_KEY

This adds the first three lines below to ~/.codex/config.toml: the variable's name, never the key. Codex reads the variable when it starts and sends it as Authorization: Bearer …. To share the server with a project, put the same table in the project's .codex/config.toml (Codex reads it in trusted projects).

[mcp_servers.cuddler]
url = "https://api.cuddler.ai/v1/mcp"
bearer_token_env_var = "CUDDLER_API_KEY"
default_tools_approval_mode = "writes"
  • Add the last line yourself: writes requires approval for tools that are not read-only. Here that includes the four creates, cancel_video, download_video, authorize_portrait and revoke_portrait_authorization; free does not mean read-only. See the Codex configuration reference.
  • codex mcp list shows the server with bearer-token authentication. In the Codex terminal UI, /mcp lists the active servers.

Other clients

Any MCP client that can send a request header can connect: choose Streamable HTTP (often called http; not SSE), the URL above and the Authorization header. Many clients read an mcpServers object like this one:

{
  "mcpServers": {
    "cuddler": {
      "type": "http",
      "url": "https://api.cuddler.ai/v1/mcp",
      "headers": {
        "Authorization": "Bearer ${CUDDLER_API_KEY}"
      }
    }
  }
}

Field names and the way to refer to an environment variable differ between clients: ${CUDDLER_API_KEY} in Claude Code, ${env:CUDDLER_API_KEY} in Cursor. Use the form your client documents. If a client cannot read environment variables, its configuration file holds your key: keep that file out of every repository.

Check the connection

To see what a key gets without any client, ask for the tool list:

curl https://api.cuddler.ai/v1/mcp \
  -H "Authorization: Bearer $CUDDLER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

A live key gets 23 tools and a test key 8. A 401 means the key is missing, mistyped or revoked. The Accept header is required: without it the server answers 406.

Tools

ToolWhat it doesEndpointTest key
get_video_referencesThe reference preparation status and authorization actions for an existing video. Read-only.GET /v1/videos/{id}/referencesNo
authorize_portraitStarts or reuses official verification for a reference asset id (reference_id). May return authorization_url for the person. No video or generation charge; not read-only.POST /v1/portraitsNo
get_portrait_authorizationChecks official verification and refreshes the stored authorization status; creates no video.GET /v1/portraits/{id}No
revoke_portrait_authorizationRevokes this organization's portrait authorization, prevents new use and schedules remote-copy removal. Free, but destructive and not read-only.POST /v1/portraits/{id}/revokeNo
list_modelsEvery model in brief: whether your organization can use it, its limits and its price range. Agents call it first.GET /v1/modelsYes
get_modelOne model in full, with its complete price list.GET /v1/models/{id}Yes
estimate_videoPrices a video and the hold it would take. Free.POST /v1/videos/estimateYes
create_videoCreates a video job. Spends your balance.POST /v1/videosNo
get_videoOne video: status, final charge, the failure reason, or a fresh download link once it succeeds.GET /v1/videos/{id}No
list_videosYour videos, newest first, a page at a time.GET /v1/videosNo
cancel_videoCancels a queued video and releases its hold.POST /v1/videos/{id}/cancelNo
download_videoA watermarked video download link. The first call transcodes a file; later calls reuse it. Free, but not read-only. At most 20 new watermarked files per 10 minutes per organization.GET /v1/videos/{id}/download?watermark=trueNo
estimate_imagePrices an image. Free.POST /v1/images/estimateYes
create_imageCreates an image job. Spends your balance.POST /v1/imagesNo
get_imageOne image: status, final charge, the failure reason, or a fresh download link once it succeeds.GET /v1/images/{id}No
list_voicesThe voices a speech model can use: id, name, languages, a sample and the price. Free.GET /v1/voicesYes
estimate_speechPrices speech for your text and voices, and the hold it would take. Free.POST /v1/speech/estimateYes
create_speechCreates speech: an MP3 of your text in one voice, or a dialogue between voices. Spends your balance.POST /v1/speechNo
get_speechOne speech job: status, final charge, the failure reason, or a fresh download link once it succeeds.GET /v1/speech/{id}No
estimate_musicPrices one music generation and the hold it would take. Free.POST /v1/music/estimateYes
create_musicCreates music: one MP3 from a prompt. Spends your balance.POST /v1/musicNo
get_musicOne music job: status, final charge, the failure reason, or a fresh download link once it succeeds.GET /v1/music/{id}No
get_balanceYour balance: total, held, available, and today's spend against the daily limit.GET /v1/balanceYes
  • A live key is offered all 23 tools. A test key is offered only the 8 that read or estimate, so an agent holding it never sees a tool that spends.
  • Each call runs its endpoint with your key, so it is validated, priced, held, queued and limited exactly like a direct call. Media fields take an upload id (upl_…) or a public https:// URL. Uploads, the image, speech and music lists, canceling speech or music, and usage are not tools: use the REST API for them (API reference).
  • Results that contain a prompt or metadata are wrapped in <untrusted-user-content>, and the tool descriptions tell the agent to treat that text as data, never as instructions.

Speech and music

  • create_speech takes text with one voice_id, or a dialogue of up to 50 lines and 10 voices on a model whose list_models entry shows dialogue: true. One request can be up to the model's max_characters long, counting all lines.
  • Each voice_id must be one of that model's voices. list_voices lists them for any speech model your organization can use, with each voice's languages, a sample and its price. Without a key, the public catalog, GET /v1/catalog, lists the voices of publicly available models under voices.
  • Music has no duration field. Each model writes one piece of at most its max_duration: Lyria 3 Pro up to 180 seconds, Lyria 3 up to 30, Lyria 2 up to 33, and Eleven Music 2.5 always 30. A generation is billed once, whatever its length.
  • Speech and short music often finish within the create call; otherwise poll get_speech or get_music. A long piece can take a few minutes. output.url is a private MP3 link valid for one hour, like video and image links, and the file is kept until output.retained_until.
  • In list_models, speech and music entries name the tools that make them in tools.

Reference images and portrait authorization

  • If get_video reports stage: preparing_references, keep polling the same video id after poll_after_seconds. Use get_video_references to inspect preparation and any required authorization. Do not create another video while the original is preparing; preparation adds no generation charge.
  • If a rejected reference needs the person's official authorization, get their agreement before calling authorize_portrait. Its reference_id is the reference asset's references[].id from get_video_references. A valid pending or active authorization is reused. If the result includes authorization_url, give it to that person: they must complete identity and liveness verification themselves. An agent must never do it for them; an already-active authorization may return no URL.
  • The id for get_portrait_authorization and revoke_portrait_authorization is the authorization record id from authorize_portrait or references[].authorization_id, not the video or reference asset id. Use get_portrait_authorization to check the current status; it may query the official service and refresh the stored status. Stop and report failed, expired or revoked instead of polling forever for active. Authorization does not restart a video whose status is failed. Only after that explicit failure, ask the user to confirm any new generation and its price; a new logical job needs its own idempotency_key. Replaying the old key does not create a new video.
  • authorize_portrait and revoke_portrait_authorization do not charge generation credits, but they change organization and external-service state. Require approval before either. Revocation immediately withdraws this organization's authorization, prevents new use and schedules removal of the remote copy. It does not instantly remove every copy or invalidate a verification URL already issued by the official service.

Spending safely

  • Only the four creates spend money: create_video, create_image, create_speech and create_music. Their MCP annotations mark them as destructive and not read-only. Make sure your client asks you before it runs them: see the notes for Claude Code, Cursor and Codex above.
  • Estimate first. Configure your client to have the agent price a job with the matching estimate tool (estimate_video, estimate_image, estimate_speech or estimate_music) and tell you the price before creating. This is a client workflow recommended by the server instructions, not a server-enforced prerequisite. A create holds the estimate from your balance until the job settles; a failed, blocked or canceled job costs nothing.
  • Every create carries a ceiling. All four creates require max_usd (optional on the REST API). The agent passes the estimate's hold_usd, or a higher amount you agreed to. A job that would hold more is refused with price_ceiling_exceeded, which states the amount needed, and nothing is held or charged; the final charge never exceeds the ceiling. The server validates max_usd and idempotency_key on each create. A per-job ceiling does not limit job count or total spending.
  • Retry with the same idempotency_key. Each create needs an idempotency_key (8 to 128 characters from A–Z a–z 0–9 . _ : -), one per job. If a call fails or times out, the agent retries with the same key and the same arguments and gets back the job already created, with a note that nothing new was created or charged. The same key with different arguments is refused with idempotency_conflict; never reuse a key for another job (Idempotency).
  • Check your organization's actual daily limit. New standard organizations default to no daily cap; existing organizations retain their configured value. Read daily_limit_usd from get_balance: 0.000000 means no daily cap, so spending is bounded by the available balance. Any configured cap covers every key and MCP job (Limits).

Limits

ItemLimit
Requests to /v1/mcpEach one (connecting, listing tools, calling a tool) counts as one read: 300 per minute per key
Tool callsEach call also counts against its endpoint's budget, as a direct call would: GET endpoints as reads (300 per minute), POST endpoints (estimates, creates, cancel, portrait authorization and revocation) as writes (60 per minute); download_video counts as a write even though its endpoint uses GET
New portrait authorizationsAt most 3 per hour per organization; a valid pending or active authorization is reused before this limit is checked
Request bodyOne JSON-RPC message, up to 256 KiB
Organization limitsVideos rendering at once, the queue and the daily spending limit apply as for any key (Limits)

So a get_video call uses two reads, and an estimate_video call one read and one write. A download_video call also uses one outer read and one endpoint write. get_video_references and get_portrait_authorization each use two reads; authorize_portrait and revoke_portrait_authorization each use one outer read and one endpoint write.

Errors

When the server refuses the request itself, the client reports a failed connection or call with the HTTP status:

HTTPcodeMeaning
401unauthorizedNo key, a mistyped or revoked key, or a variable the client did not replace (the server got the text ${…}). There is no sign-in to fall back to: check that the variable is set where the client starts, then restart the client.
403organization_suspendedYour organization is suspended. Contact support.
429rate_limitedThe key has used its 300 reads this minute. Wait Retry-After seconds.

A client set to the older SSE transport fails with 405: choose Streamable HTTP.

When the API refuses a tool call, the client shows the tool result as an error. Its text starts with the error code and ends with the request id:

insufficient_balance: The available balance does not cover this job's hold
{"available_micros":1250000,"required_micros":2482172}
request_id: 5f0c2e8a-3b1d-4c6e-9a7f-2d8b1e4c6a90

Clients that read structured results find the same fields in the result's _meta["cuddler/error"]: status, code, message, details, request_id, and retry_after when supplied by a 429 response.

codeWhat to do
insufficient_balance (402)Add funds in the console under Billing, or wait for running jobs to settle.
spend_limit_reached (400)Your organization reached the monthly spend limit it set. Billing members can raise or remove it in the console under Billing; otherwise do not retry before resets_at (00:00 UTC on the 1st).
rate_limited, queue_full, daily_limit_reached (429)Follow Retry after N seconds. when provided; otherwise back off instead of retrying immediately. Retry with the same tool arguments. For a create, keep the same idempotency_key; authorize_portrait accepts only reference_id, without generation-only fields.
idempotency_conflict (409)The idempotency_key was already used for a different job. Use a new key for a new job.
content_blocked (422)The prompt or an input breaks the content policy. Nothing is charged.

If a key leaks

  1. Revoke it in the console under API keys. A revoked key stops working immediately. If you cannot, write to support@cuddler.ai and we will revoke it.
  2. Create a new key, set CUDDLER_API_KEY to it and restart your clients. Configurations that name the variable need no change.
  3. Check what the key was used for: in the console, Analytics breaks spending down by API key, and every job records the key that created it (api_key_id).
  4. Deleting the file or rewriting Git history does not make a key that was pushed safe again. Revoke it first.