Generate images
Magic Edit
Create video
Track jobs & credits
/mcp, no trailing slash) serves
both authentication modes. The transport is stateless: every tool call returns a
single JSON response, and generation tools return a job id immediately so nothing
holds a long-lived stream open.
Get connected in three steps
Get your credentials
Add the server
https://api.samsa.ai/mcp. There’s nothing to install
and no local process — see your client below for the
exact one-time setup.Authentication
The MCP endpoint accepts two credential types on the same URL. Pick the one that matches your client:| Mode | Best for | How it works |
|---|---|---|
| OAuth 2.1 | Interactive apps — Claude (web/desktop), ChatGPT | You sign in with your Samsa account and approve a consent screen in the app. The client handles the token; you never paste a key. |
API key (samsa_sk_…) | Headless clients — Claude Code, Cursor, VS Code, n8n, SDKs | Send Authorization: Bearer samsa_sk_…. Create keys in Settings → API Keys; the key’s scopes gate which tools it can call. |
401 challenge, registers itself dynamically
(PKCE, no client secret), and sends you through a consent screen before
exchanging a short-lived access token. The interactive browser consent flow is
in early access — if a sign-in doesn’t complete, tell us at
support@samsa.ai.Tools
The server exposes nine tools. The four reads (list_models, get_model,
get_job_status, get_credit_balance) and the two model-management tools
(create_model, update_model) are free; the three generation tools cost
credits from your organization’s pool, at the same rates as the
app and REST API.
| Tool | What it does | Scope | Cost |
|---|---|---|---|
list_models | List your organization’s ready trained models (id, name, category, thumbnail). | models.read | Free |
get_model | Full detail for one model — status, reference images, default prompt, trigger words. | models.read | Free |
create_model | Train a new model from 1–10 reference images (async). | models.write | Free |
update_model | Update a model’s name, default prompt, and/or always-applied instruction. | models.write | Free |
generate_image | Generate images from a prompt, optionally composing your trained models. | images.generate | 5 × outputs × resolution |
edit_image | Magic Edit — edit an image from a prompt. | images.edit | 5 per output |
generate_video | Generate video from a start frame, from text, or from text styled with your models. | videos.generate | 5 / second × engine × resolution × audio |
get_job_status | Poll a submitted image, edit, video, or model job for status and results. | scope of the submitting tool | Free |
get_credit_balance | Read your organization’s remaining credit balance and billing period. | usage.read | Free |
Parameters
list_models(category?)
list_models(category?)
category(optional) — filter to one ofstyle,object,person,setting.
id, name, category,
and a presigned thumbnail_url. Use the ids or names as style_id /
object_ids / person_ids / setting_ids in generate_image and
generate_video — a name resolves to a model visible to you.get_model(model_id)
get_model(model_id)
model_id(required) — the model’s id.
create_model(name, category, images, …)
create_model(name, category, images, …)
name(required) — the model name.category(required) — one ofstyle,object,person,setting.images(required) — 1–10 reference images. Each is either a publichttpsURL or an inline base64 data URI (data:image/png;base64,…) —image/jpeg,image/png, orimage/webp, ≤ 10 MB each.instruction(optional) — the model’s always-applied guidance (≤ 8000 chars), injected as mandatory (“MUST FOLLOW”) direction into every generation that composes the model. See Model Training.webhook_url(optional) — anhttpsURL notified once when training reaches a terminal status.
{ id, status: "pending", estimated_credits }
immediately; poll get_job_status(kind="model", id=…) (which also needs the
models.read scope) until completed or failed, then use the model id in
generate_image / generate_video.
Free — model creation deducts no credits. Large-file presigned uploads are
REST-only (not exposed over MCP) — use
POST /models/prepare for those.update_model(model_id, …)
update_model(model_id, …)
model_id(required) — the model to update.name(optional) — a new model name.default_prompt(optional) — a new default prompt.instruction(optional) — the model’s always-applied guidance (≤ 8000 chars). Send an empty string to clear it.
name, default_prompt, or instruction; omitted
fields are left unchanged. Synchronous — returns the full updated model
immediately (same shape as get_model). Free.generate_image(prompt, …)
generate_image(prompt, …)
prompt(required) — the text prompt.style_id,object_ids,person_ids,setting_ids(optional) — trained model ids or names fromlist_modelsto compose (a name resolves to a model visible to you).num_outputs(default1),aspect_ratio(default"1:1"),resolution(default"1K";1K/2K/4K).
{ id, status: "pending", estimated_credits }
immediately. Cost: 5 × num_outputs × resolution (1K ×1, 2K ×2, 4K ×4),
deducted at submit.edit_image(prompt, …)
edit_image(prompt, …)
prompt(required) — how to edit the image.- Exactly one of
image_id(an image in your Samsa context) orimage_url(a public https URL). engine(optional) —nano_banana_pro(default),gemini, orkontext.
{ id, status: "pending", estimated_credits }. Cost: 5
credits per output (nano_banana_pro scales with resolution: 1K ×1, 2K
×2, 4K ×4), deducted at submit.generate_video(mode, …)
generate_video(mode, …)
mode(required) — one of:image_to_video— animate a start frame. Requires exactly one ofimage_id/image_url; optionalend_image_urlon end-frame-capable engines;promptoptional.text_to_video— requiresprompt.text_to_video_styled— requirespromptandstyle_id;object_ids/person_ids/setting_idsoptional.
engine(defaultveo_3_1_lite),duration(default: the engine’s shortest supported duration, in seconds),aspect_ratio(default"16:9"; also9:16,1:1).
{ id, status: "pending", estimated_credits }. Cost:
5 / second × engine × resolution × audio multipliers; styled mode adds a
flat 10 for the intermediate image. See pricing.get_job_status(kind, id)
get_job_status(kind, id)
kind(required) —image_generation,image_edit,video, ormodel.id(required) — the job or model id a submit tool returned.
pending → processing → completed / failed) and,
once completed, presigned result URLs valid for 24 hours. Requires the scope
of the submitting tool (models.read for kind: "model").get_credit_balance()
get_credit_balance()
The async pattern
The three generation tools are asynchronous — they enqueue a job and return right away, so your client never blocks waiting for a render.Submit
generate_image, edit_image, or generate_video. It returns
{ id, status: "pending", estimated_credits, next_step } in milliseconds, and
the estimated credits are deducted from your organization’s pool at submit.Poll
get_job_status(kind=…, id=…) with the id you received. The status moves
pending → processing → completed (or failed). Image jobs typically
finish in 30 seconds to two minutes; video in one to five.Collect
completed, the response carries presigned result URLs valid for 24
hours. If a job ends failed on Samsa’s side, the credits are automatically
refunded to the same pool.Set up your client
Addhttps://api.samsa.ai/mcp to your client below. Claude and ChatGPT
sign in with OAuth; every other client authenticates with an
API key (Authorization: Bearer samsa_sk_…).
- Claude
- ChatGPT
- Claude Code
- Cursor
- VS Code
- More clients
Add the connector
https://api.samsa.ai/mcp./mcp from the browser with
Origin: https://claude.ai, which Samsa allows, so discovery and sign-in work
without extra configuration. On desktop, follow Anthropic’s current connector
instructions and use the same server URL.Security, credits & access
- Credits.
generate_image,edit_image, andgenerate_videodraw from your organization’s shared credit pool at the app’s rates. Reads are free. Check the balance any time withget_credit_balance. - Scopes. Every tool requires a scope. An API key or OAuth token only exposes the tools its scopes allow — narrow a key to exactly what an integration needs.
- Revoking access. An admin revokes an API key in Settings → API Keys; revocation is terminal and takes effect on the very next call. For an OAuth connection, disconnect the connector in your client (Claude or ChatGPT connector settings); access tokens can also be revoked at Samsa’s OAuth revocation endpoint. A revoked credential stops working immediately.
Troubleshooting
Repeated sign-in prompts or 401s
Repeated sign-in prompts or 401s
401 is the server asking the client to (re)authenticate.- OAuth clients: disconnect the Samsa connector and reconnect to restart the sign-in. If consent never completes, it may be the early-access browser flow — tell us.
- API-key clients: confirm the header is exactly
Authorization: Bearer samsa_sk_...and the key is valid — a missing, expired, or revoked key returns401 invalid_api_key. Create a fresh key in Settings → API Keys if in doubt.
Which organization am I acting as?
Which organization am I acting as?
Tool call rejected — insufficient credits
Tool call rejected — insufficient credits
insufficient_credits error
before any job runs — nothing is charged. Check
get_credit_balance, then top up or upgrade in the
Samsa app. Reads are always free.Rate limited or too many jobs
Rate limited or too many jobs
- Per-key request rate — 60 requests/minute; excess returns
rate_limited. - Per-organization concurrency — at most 5 in-flight jobs at once; a sixth
returns
too_many_active_jobs. Let jobs finish (pollget_job_status) before submitting more. - MCP transport concurrency — a burst of simultaneous
/mcprequests on a single worker can return a transient429 concurrency_limit_exceededwithRetry-After: 1. Wait one second and retry.
A tool is missing or says it lacks a scope
A tool is missing or says it lacks a scope
generate_image needs images.generate. Edit the key’s scopes (or issue a new
key) in Settings → API Keys, then reconnect.
