Tokenify
Get API keyConsole
Menu

The MCP server

Image and video generation as tools an agent can call, paid from a project's balance.

View as markdown

Tokenify is a remote MCP server at https://api.tokenify.dev/mcp. An agent connected to it can list the models, price a generation before making it, generate images and video, upload a reference image, read the balance and hand its user a link to top up — through the same admission, limits and billing as the HTTP API, so a tool call costs what the equivalent request costs.

Text models are listed but not run as tools: an agent calls them over the HTTP API (chat completions, Responses or Messages) with an API key, or with a token for the whole API — a token for /mcp alone is refused there.

In the Claude and Codex apps

No terminal is needed. In Claude — claude.ai or the desktop app — open Connectors, choose Add custom connector and enter https://api.tokenify.dev/mcp; Claude opens Tokenify to sign in, and returns to Claude when you allow it. On a Team or Enterprise plan an owner adds it for the organisation.

In the Claude Code desktop app or IDE panel, type /mcp and add a server named tokenify with the HTTP transport and that URL, then start a new conversation. In the Codex app or IDE extension, open Settings > MCP servers > Add server, choose Streamable HTTP, restart, and choose Authenticate next to it. The Codex app, its IDE extension and its command line share one configuration, so adding it in one adds it to all three.

Or ask the agent: paste this into Claude Code's chat and it runs the install itself (Codex takes the codex mcp add line below the same way).

Add the Tokenify MCP server for all my projects by running: claude mcp add --transport http --scope user tokenify https://api.tokenify.dev/mcp

In a terminal

Claude Code connects with one command, and signs in through the browser the first time:

claude mcp add --transport http tokenify https://api.tokenify.dev/mcp

Codex adds it with one command and signs in with a second, which opens the browser:

codex mcp add tokenify --url https://api.tokenify.dev/mcp
codex mcp login tokenify

Signing in from another device

An agent on a server and a browser on a phone is fine. Approve on the phone, choose … is on another device, and paste the line it gives you — it carries a short code — into Claude Code's chat. The agent fetches it on its own computer, which finishes the sign-in there, and the approval page moves on to the console's Agents tab. The code works for ten minutes, only with the app that started the sign-in. If Claude Code is showing a box that asks for a URL, the page copies the sign-in URL for it. Apps wait about five minutes for a sign-in, so approve within that.

For Codex on a server, start the sign-in in a terminal there with codex mcp login --no-browser tokenify: it prints the sign-in link and asks for a Callback URL. Open the link on your phone, approve, choose Codex is on another device, copy the sign-in URL and paste it at the prompt. Asked to sign in from its own chat instead, Codex waits on the sign-in in the foreground and cannot act on a line pasted meanwhile.

Every connected app is listed on the console's Agents tab: who connected it, when it was last used, what it has spent, and the limits it was connected with — which kinds of model, a daily limit, and the amount at or above which it must ask you first. Change them there, or disconnect it. The daily limit is hard: a call is refused unless the most it could cost fits in what is left of the day, counting what has settled and what is still running; the ask-first amount makes Tokenify refuse a tool call at or above it unless the agent passes the price you agreed to.

Running Codex unattended

Codex asks you to approve every tool call that is not read-only, which is what you want in a conversation. Under codex exec, where nobody is there to approve, it refuses them instead (“MCP tool call requires approval”); for automation, approve the Tokenify tools for that run:

codex exec -c 'mcp_servers.tokenify.default_tools_approval_mode="approve"' "…"

Pass it per run, as above. Written into ~/.codex/config.toml instead, it applies to your conversations too, where Codex then stops asking before a call that spends; Tokenify still asks for your agreement at or above the project's confirmation threshold.

Any client that speaks the Streamable HTTP transport works the same way: give it the URL. It discovers how to sign in from the server (OAuth), and the person picks the project whose balance the agent may spend. A client that takes a header instead can send an API key as Authorization: Bearer tk-live-….

The server speaks the 2025-06-18 and 2025-03-26 revisions of the protocol, statelessly: every message is a POST answered in full, with no session to keep open. Under 2025-03-26 a POST may carry a batch of up to 20 messages; 2025-06-18 removed batching, so a client on it sends one message per POST. A connection sends at most 300 messages a minute.

The tools

ToolWhat it doesCosts
list_modelsImage, video and text models with their prices; video per second, by resolution.Nothing
estimate_costThe most a generate call would cost, the balance, and whether the project asks for confirmation at that price. Takes the generate call’s arguments. With a reference video uploaded through create_upload it also gives the likely cost at the video’s measured length; the hold still assumes the longest reference a request may carry.Nothing
generate_imageGenerates 1–4 images, from a prompt and optional reference images; returns URLs that expire after 7 days.The images
generate_videoStarts a video and returns a job id. At most 3 unfinished videos per project from agents.The video, when it finishes
get_jobA video’s status, and its URL once it has succeeded. Can wait up to 25 seconds.Nothing
create_uploadA link to upload a local image (up to 10 MB), video (MP4 or MOV, up to 50 MB) or audio file (MP3 or WAV, up to 15 MB) with curl from the agent’s shell, so the file does not pass through the conversation — and the URL to send as a reference or first frame. A video uploaded this way is measured, so estimate_cost quotes it at its real length.Nothing
upload_fileStores a small PNG, JPEG or WebP (up to 2 MB) sent as base64, for use as a reference image or first frame.Nothing
get_balanceThe balance, what agents have spent today, and the project’s spending settings.Nothing
top_upA link for the user to add credit to the project, valid for 30 minutes.Nothing

Generated files are kept for seven days: an agent should download what it needs into the project. Uploads count against 100 an hour per connection and 300 an hour per project.

What an agent may spend

A project decides, in the console under Settings → Agents, three things about the money its agents spend through MCP. HTTP requests with the same key are not affected by any of them.

SettingDefaultWhat happens
Ask before spending$1A call that would cost at least this much is refused with confirmation_required and the exact price, unless it names a max_cost_usd. The agent tells the user the price; if they agree, it calls again with max_cost_usd set to it. 0 never asks.
Daily capNoneA call that would take the day’s agent spend — settled, plus videos still running, plus the call itself — past the cap is refused with agent_daily_cap_reached. Resets at 00:00 UTC. A budget rather than a hard limit: image calls running at the same moment are not counted against each other, so a burst can end a little past the cap.
RemindersNoneUp to five amounts. When agents pass one in a day, the owners and admins are emailed, and the next tool result says so once.

max_cost_usd on a generate call is a ceiling either way: a call that would cost more is refused with price_above_max and its price, and nothing is held. What is charged follows what was delivered, and is never more than the price quoted.

Topping up from the conversation

When a call is refused for want of credit, the tool’s error says what is missing — the balance and the price — and carries a link the agent passes to its user. top_up makes one on request, for an amount the agent suggests. The link opens Tokenify’s payment page for the project: the person signs in as the account that connected the agent, picks an amount and pays by card or crypto. Once the payment clears, the agent can try again.

A link only works for the person whose agent made it, while they can add credit to the project — an owner or an admin — and only puts money into that project. For 30 minutes, and until a payment through it goes through, it can start a checkout; a payment page it already opened can still be paid after that, and credits the project like any other. Video models open once a project has paid in at least $5; a free project’s video request is answered with a link too.

Tool errors

A refused tool call is a tool result with isError: true, whose text starts with the reason in brackets, then says what to do. The HTTP API’s codes keep their meaning here — see errors — and these are the MCP server’s own:

CodeMeaningRetry?
confirmation_requiredAt or above the price the project asks agents to confirm. The text gives the price.Yes — with max_cost_usd, once the user agrees
agent_daily_cap_reachedThe call would take the project’s daily agent spend past its cap.After 00:00 UTC, or a higher cap
price_above_maxThe call would cost more than max_cost_usd. The text gives the price.With a higher ceiling
insufficient_creditNot enough credit; the text has the balance, the price and a top-up link.Once the user has paid
video_needs_topupVideo needs a project that has paid in at least $5; the text has a link.Once the user has paid
moderation_blockedThe model refused the prompt or an input. Nothing was charged.With a different prompt
too_many_uploadsPast 100 uploads an hour for the connection, or 300 for the project.Within the hour
too_many_topup_linksPast 30 top-up links an hour for the connection. The text gives the billing page.Use a link already made
invalid_amountA top_up amount outside $5–$5,000.With an amount inside it

Last updated 2026-11-25.