Relay
v0.1.9Run any Relay model (image, video, audio, LLM), poll tasks, upload files and search Relay's docs.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
search_models Search Relay models
Lists Relay models by tag and/or text. Common tags: text-to-image, image-to-image, text-to-video, image-to-video, video-to-video, text-to-speech, speech-to-text, text-to-text, text-to-embedding. image-to-image also lists every image model that takes an input image. Returns name, tag, route and accepts (input media the model takes, e.g. ["image"]; [] for none) per model (at most 50). With a credential the list is your account's view (what its tier and grants can run), public otherwise. Then call get_model with a name for its input schema.
| Parameter | Type | Description |
|---|---|---|
query | string | Words to match, case-insensitive; every word must appear in the name, display name or tag (e.g. 'kling v3'). |
tag | string | Model type tag, e.g. text-to-image or image-to-video. Omit for every tag. |
get_model Get a Relay model
Returns one model's route, endpoints (for chat models, the API formats it is served in: chat_completions, and responses when it also runs on the OpenAI Responses API), request_schema (what run_model's input must follow), request_example, pricing and availability. Pass endpoint: responses for that route's request_schema and example. With a credential the answer is your account's view (what its tier and grants can run), public otherwise. Then call run_model with an input shaped like request_example (and the same endpoint).
| Parameter | Type | Description |
|---|---|---|
model * | string | Exact model name from search_models, e.g. google/gemini-nano-banana-2.1. |
endpoint | string | responses: that route, its request_schema and request_example (a model whose endpoints lists it; Relay refuses any other). Omit for the model's own route. |
get_pricing Get Relay pricing
Returns Relay's list prices (USD), optionally for one model (with a credential your account's view: its tier and grants; public otherwise), plus media_storage: the per-file fees of the store_output / upload retention SKUs (relay1d, relay7d, …). Then estimate_cost for a number.
| Parameter | Type | Description |
|---|---|---|
model | string | Model name (e.g. google/gemini-nano-banana-2.1) to keep only its rows. Omit for every model. |
estimate_cost Estimate a Relay cost
Estimates the USD cost of a call from the price list (with a credential your account's view: its tier and grants; public otherwise): an estimate, not an invoice (the bill uses provider-reported usage and any custom pricing on your account). Pass only the usage fields the model's billing_type (see get_model or get_pricing) reads: per_token: input_tokens, output_tokens, cached_input_tokens; per_image: image_count, resolution_tier; per_second_video: duration_seconds, quality_mode, sound; per_second_audio: duration_seconds; per_character: character_count; per_media_token: media_input_tokens, media…
| Parameter | Type | Description |
|---|---|---|
model * | string | Exact model name, e.g. KlingTeam/v3-T2V. |
usage * | object | What the call uses; only the fields of the model's billing type matter. |
run_model Run a Relay model
Runs any Relay model by name (billed to your key). input follows get_model's request_schema (request_example runs as is). Every model whose schema takes async (image, video, audio) is submitted as a task: it waits up to 45 s, past that it returns a task_id — do not resubmit, call check_task. Chat models answer inline. Result links expire 1 h after completion (by default) unless store_output names a media_storage SKU from get_pricing. Pass an idempotency_key if you may retry the same submit. endpoint: responses runs a model whose get_model endpoints lists responses on the OpenAI Responses API…
| Parameter | Type | Description |
|---|---|---|
input * | object | Request body per get_model's request_schema, without model, store_output or async (run_model sets them). Pass media as *_url links (upload_file makes one). mode: direct (Relay's providers, the default… |
model * | string | Exact model name from search_models / get_model, e.g. google/gemini-nano-banana-2.1. |
endpoint | string | responses: run a chat model on the OpenAI Responses API (one its get_model endpoints lists; Relay refuses any other before anything runs). Omit for the model's own route. |
idempotency_key | string | Your key for this submit (task models; a chat answer is not replayed): a retry with the same key and the same input replays the first task instead of starting (and billing) a new one; the same key wit… |
inline_images | boolean | Also return images ≤ 1 MB as image content blocks (default false: links only). |
store_output | string | Keep result media longer: a media_storage SKU from get_pricing (e.g. relay7d, adds its per-file fee), or provider (default, 1 h). |
wait_seconds | integer | Seconds to wait for it to finish (0–45, default 45); 0 returns the task_id at once. |
check_task Check a Relay task
Checks a task run_model returned (no key needed: the task_id is the capability). Waits up to 30 s for it to finish; returns the result when completed, else its status: then call check_task again, never resubmit. Task results are kept 1 h after they finish.
| Parameter | Type | Description |
|---|---|---|
task_id * | string | The task_id from run_model, e.g. direct:2f9c… |
inline_images | boolean | Also return images ≤ 1 MB as image content blocks (default false: links only). |
wait_seconds | integer | Seconds to wait for it to finish (0–30, default 30); 0 just reads the status. |
upload_file Upload a file to Relay
Hosts an image, video or audio file on Relay and returns its url: pass that url to any *_url input of run_model. Give exactly one of path (local server only, ≤ 100 MB), base64 (≤ 4 MB) or url (a public link Relay copies). retention: relay1h (default, free within a daily quota) or a media_storage SKU from get_pricing. Needs a Relay credential.
| Parameter | Type | Description |
|---|---|---|
base64 | string | File content as base64 or a data: URI, at most 4 MB decoded. Larger files: pass url. |
filename | string | File name to record (defaults to the path's base name). |
path | string | Local file path (stdio server only; the hosted server cannot read your disk). Max 100 MB. |
retention | string | How long the link lives: relay1h (default, free within a daily quota) or a media_storage SKU from get_pricing (relay1d, relay7d, …). |
slot | boolean | true: get a single-use upload URL (10 minutes): run the curl line in your shell on the local file, or open open_url in a browser and pick the file; either prints the hosted link. |
url | string | Public http(s) link to copy onto Relay. |
list_workflows List workflows
List Relay's workflow templates: multi-step pipelines (e.g. script → voiceover) run as one call. Each entry has workflow_id, input_schema and its steps (step_id + model). Run one with run_workflow; inputs follow input_schema.
run_workflow Run a workflow
Start a workflow run (one submit) and wait up to wait_seconds (≤ 45) for it to finish. Completed → the final output; still running → run_id: call check_workflow_run with it, never resubmit (a new run bills again). Each step is billed as an ordinary request. webhook_url gets ONE signed workflow.completed / workflow.failed delivery when the run ends. Get workflow_id and the inputs shape from list_workflows. Needs a Relay credential.
| Parameter | Type | Description |
|---|---|---|
inputs * | object | Template inputs, an object matching the workflow's input_schema. |
workflow_id * | string | Workflow template id from list_workflows, e.g. `script-voiceover`. |
idempotency_key | string | Idempotency-Key for the submit: the same key and inputs within 24 h return the same run_id instead of a new run. Generated when omitted. |
store_output | string | Run-level storage for every media step: `provider` (default, 1 h link) or `relay1d` / `relay7d` / `relay30d` (billed per file, see get_pricing). |
wait_seconds | integer | Seconds to wait for it to finish (0–45, default 45); 0 returns the run_id at once. |
webhook_url | string | HTTPS URL for one signed workflow.completed / workflow.failed delivery when the run ends. |
check_workflow_run Check a workflow run
Poll a workflow run by run_id, waiting up to wait_seconds (≤ 30) for it to end. Completed → the final output; failed / cancelled → the error; still running → its steps so far: call check_workflow_run again. No key needed: the run_id is the access token.
| Parameter | Type | Description |
|---|---|---|
run_id * | string | The run id returned by run_workflow (`wf:…`). |
wait_seconds | integer | Seconds to wait for it to finish (0–30, default 30); 0 answers the current state at once. |
cancel_workflow_run Cancel a workflow run
Cancel a workflow run. Cancels between steps only: a step already running completes and bills. A run that has already ended answers WORKFLOW_RUN_NOT_CANCELLABLE. Needs a Relay credential.
| Parameter | Type | Description |
|---|---|---|
run_id * | string | The run id returned by run_workflow (`wf:…`). |
get_credits Get credit balance
Read the account's credit balance, active promo credits and consumption. Needs a dashboard JWT or a custom-tier superkey; a plain inference key gets PERMISSION_DENIED (403). Needs a Relay credential.
get_usage Get usage
Read the account's usage and spend per API key, newest keys first, 10 keys per page (pass starting_after = the previous answer's next_cursor for the next page; limit up to 1000). Pass period (e.g. 7d, max 30d) for a by-date breakdown, or from + to. Needs a dashboard JWT or a custom-tier superkey; a plain inference key gets PERMISSION_DENIED (403). Needs a Relay credential.
| Parameter | Type | Description |
|---|---|---|
from | string | Start date `YYYY-MM-DD`; use together with `to`. |
limit | integer | Keys per page (default 10, max 1000). |
period | string | Time period shorthand, e.g. `7d` or `30d` (max 30 days); adds a by-date breakdown. |
starting_after | string | Cursor: the `next_cursor` of the previous page. |
to | string | End date `YYYY-MM-DD`; use together with `from`. |
search_docs Search the Relay docs
Search Relay's public docs (bundled, offline) for how-to, auth, errors, limits, retries, webhooks, files and pricing rules. Returns the best-matching sections: page, heading, docs path with anchor and an excerpt. For a model's input fields use get_model instead; to find a model use search_models.
| Parameter | Type | Description |
|---|---|---|
query * | string | What to look for, in plain words, e.g. `idempotency key` or `file retention`. |
limit | integer | How many sections to return (1–10, default 5). |