← Receivers

media:generate

media family

mcp

Generate ONE image from a prompt and file it in the workspace's media library. Keyless — flux-1-schnell on the Cloudflare AI binding. Returns the key and the url that serves it. Unlike the storefront generator this takes no destination: it always writes `{workspace}/media/`, because a library is a prefix and not a context.

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
member
The class of authority the caller must already hold, decided from the attested context with no round trip.
Cost
variable
What one call costs, so you can budget before acting.
Reversible
no
This cannot be undone. Dry-run it first where the contract allows.
Idempotent
no
Not safe to blind-retry — dedupe on the envelope idempotencyKey.

Send it with your agent

One click hands your coding agent a prompt that registers the substrate, reads this contract, and makes the call. Launch opens the app; the others copy the prompt.

Claude Code
Codex
Cursor
Gemini CLI
Claude Desktop
ChatGPT
curl -X POST https://one.ie/api/ask/media:generate \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "workspace": "one", "prompt": "a wide banner of a quiet harbour at dawn, muted palette" }}'

The key is never in a link. npx -y @oneie/cli login writes it to ~/.config/oneie/key on your machine.

Request

Validated before dispatch — an invalid payload is refused with the fix, never half-applied.

  • workspace string optional Group slug. Omit for your own. Honoured only if you may read it.
  • prompt string required What to draw. Truncated at 2000 chars after `context` is folded in.
  • context string optional Extra prompt material — brand, palette, subject. A QUALIFIER appended to the prompt, NOT a destination: it never changes the key prefix.

Response

What comes back from the call.

  • ok boolean
  • workspace string
  • key string `{workspace}/media/{uuid}.{ext}` — a uuid, never a timestamp: the url it names is served by a PUBLIC reader, so the name is the only thing standing between the object and a stranger.
  • url string `/api/product-image/{workspace}/{path}` — THE reader.
  • kind "image"
  • contentType string Sniffed from the returned bytes — flux returns JPEG today and returned PNG when the storefront door was written.
  • size number
  • error string Named: forbidden · not_configured (no AI or CONTENT binding) · generation_failed · storage_error.

Traffic

Every call to media:generate, counted where it is dispatched — over HTTP or in-process alike. Aggregate only — no actor, no payload, no workspace.

Counting…

Wiring

Every place in the open source that names media:generate, and the file that answers it. Read from the tree at build time — a receiver is reached by NAME through one door, so there is no import edge to follow and a grep is the honest shape of the question. Structure, not volume — the count is in Traffic above.

Called from

SDK 2
  • packages/sdk/src/client.ts:933
  • packages/sdk/src/media.ts:11

Answered by

media:generate one.ie/web/src/lib/resolvers/media.ts:362 Dispatched through POST /api/ask/media:generate, after the envelope validates the payload.

media family · 2 more

JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "workspace": {
      "description": "Group slug. Omit for your own. Honoured only if you may read it.",
      "type": "string"
    },
    "prompt": {
      "type": "string",
      "minLength": 1,
      "description": "What to draw. Truncated at 2000 chars after `context` is folded in."
    },
    "context": {
      "description": "Extra prompt material — brand, palette, subject. A QUALIFIER appended to the prompt, NOT a destination: it never changes the key prefix.",
      "type": "string"
    }
  },
  "required": [
    "prompt"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "workspace": {
      "type": "string"
    },
    "key": {
      "description": "`{workspace}/media/{uuid}.{ext}` — a uuid, never a timestamp: the url it names is served by a PUBLIC reader, so the name is the only thing standing between the object and a stranger.",
      "type": "string"
    },
    "url": {
      "description": "`/api/product-image/{workspace}/{path}` — THE reader.",
      "type": "string"
    },
    "kind": {
      "type": "string",
      "const": "image"
    },
    "contentType": {
      "description": "Sniffed from the returned bytes — flux returns JPEG today and returned PNG when the storefront door was written.",
      "type": "string"
    },
    "size": {
      "type": "number"
    },
    "error": {
      "description": "Named: forbidden · not_configured (no AI or CONTENT binding) · generation_failed · storage_error.",
      "type": "string"
    }
  },
  "required": [
    "ok"
  ]
}