(a2e-media-client)(a2e-media-client config)A2EMediaClient (a2e): the embedded a2e.json style (§7G.9). :key or
A2E_API_KEY at call time; :url replaces baseUrl; :model is written to the
image body's model_type; gather defaults to download.
A2EMediaClient (`a2e`): the embedded a2e.json style (§7G.9). :key or A2E_API_KEY at call time; :url replaces baseUrl; :model is written to the image body's model_type; gather defaults to download.
examples/media-styles/a2e.json, byte for byte (a test asserts the copy). A string literal rather than a resource: it is the one shipping form that both hosts (JVM classpath, cljgo AOT) read identically.
examples/media-styles/a2e.json, byte for byte (a test asserts the copy). A string literal rather than a resource: it is the one shipping form that both hosts (JVM classpath, cljgo AOT) read identically.
(available style)§7G.10b style.available() on a loaded style -> {:installed :loggedIn :reason},
fast, generating nothing and reading no secret. CLI preset: the command
(config :command first element, else the CLI name) is found, and the CLI's own
login file EXISTS (never read). Mock preset: always available unless
TOOLNEXUS_MEDIA_MOCK_AVAILABLE=0. HTTP style: config :key, or every ${VAR}
in its headers set. Env is read through config :env when given.
§7G.10b `style.available()` on a loaded style -> {:installed :loggedIn :reason},
fast, generating nothing and reading no secret. CLI preset: the command
(config :command first element, else the CLI name) is found, and the CLI's own
login file EXISTS (never read). Mock preset: always available unless
TOOLNEXUS_MEDIA_MOCK_AVAILABLE=0. HTTP style: config :key, or every ${VAR}
in its headers set. Env is read through config :env when given.(cli-media-client spec config)CliMediaClient (§7G.10): run a local CLI once, headless, read its JSON-lines
stdout, collect files, kill on cancel/timeout. spec:
:name client name
:verbs #{"image" …}
:default-command executable when config :command is absent
:argv (fn [{:keys [prompt cwd model]}]) -> [arg …]
:env fixed child env {name value}
:templates {verb "… {prompt} …"}
:parse (fn [obj line]) -> {:session :text :paths :error :status}
:folder optional (fn [config session]) -> dir to scan
:unavailable (fn [verb error]) -> message when unavailable, else nil
:mock true => never spawn; return a fixed file (§7G CLI mock presets)
CLI clients accept prompt plus size hints (image: width, height,
aspectRatio; video: seconds, aspectRatio), folded into the prompt by
fold-media-prompt.
CliMediaClient (§7G.10): run a local CLI once, headless, read its JSON-lines
stdout, collect files, kill on cancel/timeout. `spec`:
:name client name
:verbs #{"image" …}
:default-command executable when config :command is absent
:argv (fn [{:keys [prompt cwd model]}]) -> [arg …]
:env fixed child env {name value}
:templates {verb "… {prompt} …"}
:parse (fn [obj line]) -> {:session :text :paths :error :status}
:folder optional (fn [config session]) -> dir to scan
:unavailable (fn [verb error]) -> message when unavailable, else nil
:mock true => never spawn; return a fixed file (§7G CLI mock presets)
CLI clients accept prompt plus size hints (image: width, height,
aspectRatio; video: seconds, aspectRatio), folded into the prompt by
`fold-media-prompt`.(codex-media-client)(codex-media-client config)CodexMediaClient (codex): image through codex exec --json on the user's
ChatGPT plan. The file comes from the reply text or
$CODEX_HOME/generated_images/<thread> (§7G.10).
CodexMediaClient (`codex`): image through `codex exec --json` on the user's ChatGPT plan. The file comes from the reply text or $CODEX_HOME/generated_images/<thread> (§7G.10).
(create-media clients)§7G.3 createMedia: one MediaClient or a seq of them. Each verb goes to the
first client that supports it; an unavailable error falls through to the
next. (create-media []) throws media: no clients.
§7G.3 `createMedia`: one MediaClient or a seq of them. Each verb goes to the first client that supports it; an `unavailable` error falls through to the next. `(create-media [])` throws `media: no clients`.
(elevenlabs-media-client)(elevenlabs-media-client config)ElevenLabsMediaClient (elevenlabs): speech, music, transcribe, cloneVoice
(§7G.9). Key ELEVENLABS_API_KEY, header xi-api-key.
ElevenLabsMediaClient (`elevenlabs`): speech, music, transcribe, cloneVoice (§7G.9). Key ELEVENLABS_API_KEY, header xi-api-key.
(fal-media-client)(fal-media-client config)FalMediaClient (fal): any hosted model id over fal's queue API (§7G.9).
Key FAL_API_KEY, header Authorization: Key <key>.
FalMediaClient (`fal`): any hosted model id over fal's queue API (§7G.9). Key FAL_API_KEY, header `Authorization: Key <key>`.
(fold-media-prompt verb args)§7G CLI hint folding: the prompt a CLI style receives — prompt, then the
present size hints in canonical verb order as " (h1, h2)"; nothing appended
when none is present. args keys may be keywords or strings.
§7G CLI hint folding: the prompt a CLI style receives — `prompt`, then the present size hints in canonical verb order as " (h1, h2)"; nothing appended when none is present. `args` keys may be keywords or strings.
(generate media verb args)(generate media verb args ctx)§7G.3 — the generic function face. verb is the canonical verb name
("image" … "cloneVoice" "talk", string or keyword; :clone-voice works
too). args maps canonical arg names (keyword or string) to values. ctx:
:cancel (atom or 0-arg fn — truthy ⇒ cancelled), :deadline (epoch ms),
:progress (fn [{:verb :client :jobId :status :elapsedMs}]),
:provider-options (map; overwrites the request body's top-level keys).
Returns MediaResult {:files [..] :text? :jobId? :status}; throws the media
error (ex-data :status) on any failure.
§7G.3 — the generic function face. `verb` is the canonical verb name
("image" … "cloneVoice" "talk", string or keyword; :clone-voice works
too). `args` maps canonical arg names (keyword or string) to values. ctx:
`:cancel` (atom or 0-arg fn — truthy ⇒ cancelled), `:deadline` (epoch ms),
`:progress` (fn [{:verb :client :jobId :status :elapsedMs}]),
`:provider-options` (map; overwrites the request body's top-level keys).
Returns MediaResult `{:files [..] :text? :jobId? :status}`; throws the media
error (`ex-data` `:status`) on any failure.(generate-media style verb args)(generate-media style verb args config)One-shot sugar: (generate (create-media (load-media-style style config)) verb args).
One-shot sugar: `(generate (create-media (load-media-style style config)) verb args)`.
Preset: Google's Antigravity CLI agy (image).
Preset: Google's Antigravity CLI `agy` (image).
Mock twin of google-agy-cli.
Mock twin of `google-agy-cli`.
(grok-media-client)(grok-media-client config)GrokMediaClient (grok): image and video through grok -p … --output-format streaming-json on the user's Grok subscription. Never edits Grok settings;
under Zero Data Retention video is unavailable (§7G.10).
GrokMediaClient (`grok`): image and video through `grok -p … --output-format streaming-json` on the user's Grok subscription. Never edits Grok settings; under Zero Data Retention video is `unavailable` (§7G.10).
(load-media-style path-or-preset)(load-media-style path-or-preset config)§7G loadMediaStyle(pathOrPreset, config?) -> a loaded style, itself a
MediaClient (pass it to create-media). A built-in preset name (xai-grok-cli,
openai-codex-cli, google-agy-cli, or a -mock twin) is served by that CLI
client; anything else is a style JSON file path (or an already-parsed style
map). config (model, command, loop, gather, …) configures the client
behind the style.
§7G `loadMediaStyle(pathOrPreset, config?)` -> a loaded style, itself a MediaClient (pass it to `create-media`). A built-in preset name (`xai-grok-cli`, `openai-codex-cli`, `google-agy-cli`, or a `-mock` twin) is served by that CLI client; anything else is a style JSON file path (or an already-parsed style map). `config` (model, command, loop, gather, …) configures the client behind the style.
(load-style path)Read one style JSON file (§7G loadMediaStyle).
Read one style JSON file (§7G `loadMediaStyle`).
(media-error msg status)(media-error msg status job-id)The media error: ex-info carrying :status (:failed | :timeout | :cancelled
| :unavailable) and :jobId when known.
The media error: ex-info carrying `:status` (:failed | :timeout | :cancelled | :unavailable) and `:jobId` when known.
(media? x)True for a value built by create-media.
True for a value built by `create-media`.
Set to "0" to make every mock preset report unavailable.
Set to "0" to make every mock preset report unavailable.
(model-parts result)§7G.6 model visibility: the parts of a ToolResult that reach the model. For a
media tool result only image parts; any other result's parts unchanged.
§7G.6 model visibility: the parts of a ToolResult that reach the model. For a media tool result only `image` parts; any other result's parts unchanged.
Preset: the codex CLI (image).
Preset: the `codex` CLI (image).
Mock twin of openai-codex-cli.
Mock twin of `openai-codex-cli`.
(openai-media-client)(openai-media-client config)OpenAIMediaClient (openai): image, video, speech, transcribe (§7G.9). Key
OPENAI_API_KEY; :url points it at any OpenAI-compatible server.
OpenAIMediaClient (`openai`): image, video, speech, transcribe (§7G.9). Key OPENAI_API_KEY; :url points it at any OpenAI-compatible server.
(openrouter-media-client)(openrouter-media-client config)OpenRouterMediaClient (openrouter): image over chat completions (§7G.9).
Key OPENROUTER_API_KEY.
OpenRouterMediaClient (`openrouter`): image over chat completions (§7G.9). Key OPENROUTER_API_KEY.
(part-path part)D20: the local path a media part came from, or nil.
D20: the local path a media part came from, or nil.
(percent-encode s)RFC 3986: keep A-Z a-z 0-9 - . _ ~, every other UTF-8 byte as %XX.
RFC 3986: keep A-Z a-z 0-9 - . _ ~, every other UTF-8 byte as %XX.
(read-path v path)§7G dotPath read: missing ⇒ nil. A segment of only digits indexes an array. The empty path "" is the whole value.
§7G dotPath read: missing ⇒ nil. A segment of only digits indexes an array. The empty path "" is the whole value.
(style-media-client style)(style-media-client style config)§7G.7 — a MediaClient over a parsed style (map, string- or keyword-keyed),
named style.name or "style". Uses config :url (replaces baseUrl), :loop,
:gather (default mode "url"), :http-client, and :key — when set, what every
${…} in the style's headers expands to. A style naming a verb outside the
seven, or mapping an arg to "", throws here.
§7G.7 — a MediaClient over a parsed style (map, string- or keyword-keyed),
named `style.name` or "style". Uses config :url (replaces baseUrl), :loop,
:gather (default mode "url"), :http-client, and :key — when set, what every
`${…}` in the style's headers expands to. A style naming a verb outside the
seven, or mapping an arg to "", throws here.(supported-verbs media)§7G media.verbs(): every verb some source supports, in canonical order.
§7G `media.verbs()`: every verb some source supports, in canonical order.
(supports? media verb)True when any client of media supports verb.
True when any client of `media` supports `verb`.
(tools media)§7G.6 — one Tool (source "media") per verb any client supports, in verbs.json order; the schema is the first supporting client's args. Execute never throws: any error is an isError ToolResult.
§7G.6 — one Tool (source "media") per verb any client supports, in verbs.json order; the schema is the first supporting client's args. Execute never throws: any error is an isError ToolResult.
(unavailable? e)True for a media error whose status is :unavailable (§7G.2) — the client cannot serve the call now (no key, no credits, quota, CLI missing, ZDR).
True for a media error whose status is :unavailable (§7G.2) — the client cannot serve the call now (no key, no credits, quota, CLI missing, ZDR).
§7G.12 D23: the default User-Agent of every media HTTP request.
§7G.12 D23: the default User-Agent of every media HTTP request.
conformance/media/verbs.json verbs, embedded verbatim (order, names, types,
descriptions, required). A test reads the fixture and asserts equality.
conformance/media/verbs.json `verbs`, embedded verbatim (order, names, types, descriptions, required). A test reads the fixture and asserts equality.
The package version (kept equal to build.clj's version; a test pins it).
The package version (kept equal to build.clj's `version`; a test pins it).
(write-path v path value)§7G dotPath write: creates objects, and arrays when the next segment is numeric (padding with nil). A scalar — or an array met by a non-numeric segment — on the path is replaced; an object met by a numeric segment is kept and the segment is written as a string key.
§7G dotPath write: creates objects, and arrays when the next segment is numeric (padding with nil). A scalar — or an array met by a non-numeric segment — on the path is replaced; an object met by a numeric segment is kept and the segment is written as a string key.
Preset: the grok CLI (image, video).
Preset: the `grok` CLI (image, video).
Mock twin of xai-grok-cli: never spawns, returns a fixed file.
Mock twin of `xai-grok-cli`: never spawns, returns a fixed file.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |