Skip to content
Registry

provider-openai

v1.2.20

OpenAI Responses provider worker with Chat Completions compatibility; implements provider::openai::stream and provider::openai::refresh_models behind llm-router.

license: Apache-2.0chat-completionsllmopenaiproviderresponses

Install

bash
iii trigger compose::add worker=provider-openai@1.2.20

Run in your project with the iii engine running. Exact versions are immutable and digest-pinned.

Functions9

provider-openai::ui-content

Function

Serve the provider-openai worker's injected console UI assets (content function for its console:script / console:style / console:module triggers).

Request
  • pathstringrequired

    The asset path from the trigger config (e.g. `state/page.js`).

Response
  • contentstringrequired

    The asset source, verbatim.

  • content_typestringrequired

    MIME type the console should serve the asset with.

provider::openai::abort

Function

Cancel the in-flight upstream stream for a request_id (router::abort fan-out), stopping billed generation immediately.

Request
  • request_idstringrequired
Response
  • abortedbooleanrequired

provider::openai::count_tokens

Function

Count prompt tokens for {model, system_prompt?, tools?, messages} locally with the tiktoken tokenizers; never runs the model and costs nothing.

Request
  • messagesany of[]required

    Wire agent messages, the same shape `provider::openai::stream` accepts. Must be non-empty.

    any of (4)
    Variant 1
    • contentone of[]required
      Show 7 nested
      one of (7)
      Variant 1
      • textstringrequired
      • typestringrequiredenum text
      Variant 2
      • attachment_idstring

        Optional link to the stored original in the session-manager attachment store. Transcript bookkeeping for lazy readers only: the harness clears it before `router::chat`, and no provider mapping reads it. Tolerated here so a block that still carries it deserializes instead of failing the request; omitted on the wire when absent.

      • datastringrequired
      • mimestringrequired
      • typestringrequiredenum image
      Variant 3
      • attachment_idstringrequired
      • mimestringrequired
      • namestringrequired
      • sizeinteger· uint64requiredmin 0
      • typestringrequiredenum file
      Variant 4
      • signaturestring
      • textstringrequired
      • typestringrequiredenum thinking
      Variant 5
      • datastringrequired
      • typestringrequiredenum redacted_thinking
      Variant 6
      • argumentsunknownrequired
      • function_idstringrequired
      • idstringrequired
      • typestringrequiredenum function_call
      Variant 7
      • contentunknown[]required
      • function_call_idstringrequired
      • is_errorboolean
      • typestringrequiredenum function_result
    • error_kindany of
      Show 2 nested
      any of (2)
      Variant 1
      valuestringenum auth_expired, rate_limited, context_overflow, transient, permanent
      Variant 2
      valuenull
    • error_messagestring
    • modelstringrequired
    • native_stop_reasonstring
    • providerstringrequired
    • rolestringrequiredenum assistant
    • stop_reasonstringrequiredenum end, length, function_call, aborted, error
    • timestampinteger· int64required
    • usageany of
      Show 2 nested
      any of (2)
      Variant 1
      • cache_readinteger· uint64min 0
      • cache_writeinteger· uint64min 0
      • cost_usdnumber· double
      • inputinteger· uint64min 0
      • outputinteger· uint64min 0
      • reasoninginteger· uint64min 0
      Variant 2
      valuenull
    • warningsstring[]
    Variant 2
    • contentone of[]required
      Show 7 nested
      one of (7)
      Variant 1
      • textstringrequired
      • typestringrequiredenum text
      Variant 2
      • attachment_idstring

        Optional link to the stored original in the session-manager attachment store. Transcript bookkeeping for lazy readers only: the harness clears it before `router::chat`, and no provider mapping reads it. Tolerated here so a block that still carries it deserializes instead of failing the request; omitted on the wire when absent.

      • datastringrequired
      • mimestringrequired
      • typestringrequiredenum image
      Variant 3
      • attachment_idstringrequired
      • mimestringrequired
      • namestringrequired
      • sizeinteger· uint64requiredmin 0
      • typestringrequiredenum file
      Variant 4
      • signaturestring
      • textstringrequired
      • typestringrequiredenum thinking
      Variant 5
      • datastringrequired
      • typestringrequiredenum redacted_thinking
      Variant 6
      • argumentsunknownrequired
      • function_idstringrequired
      • idstringrequired
      • typestringrequiredenum function_call
      Variant 7
      • contentunknown[]required
      • function_call_idstringrequired
      • is_errorboolean
      • typestringrequiredenum function_result
    • detailsunknownrequired
    • function_call_idstringrequired
    • function_idstringrequired
    • is_errorbooleanrequired
    • rolestringrequiredenum function_result
    • timestampinteger· int64required
    Variant 3
    • contentone of[]required
      Show 7 nested
      one of (7)
      Variant 1
      • textstringrequired
      • typestringrequiredenum text
      Variant 2
      • attachment_idstring

        Optional link to the stored original in the session-manager attachment store. Transcript bookkeeping for lazy readers only: the harness clears it before `router::chat`, and no provider mapping reads it. Tolerated here so a block that still carries it deserializes instead of failing the request; omitted on the wire when absent.

      • datastringrequired
      • mimestringrequired
      • typestringrequiredenum image
      Variant 3
      • attachment_idstringrequired
      • mimestringrequired
      • namestringrequired
      • sizeinteger· uint64requiredmin 0
      • typestringrequiredenum file
      Variant 4
      • signaturestring
      • textstringrequired
      • typestringrequiredenum thinking
      Variant 5
      • datastringrequired
      • typestringrequiredenum redacted_thinking
      Variant 6
      • argumentsunknownrequired
      • function_idstringrequired
      • idstringrequired
      • typestringrequiredenum function_call
      Variant 7
      • contentunknown[]required
      • function_call_idstringrequired
      • is_errorboolean
      • typestringrequiredenum function_result
    • custom_typestringrequired
    • detailsunknown
    • displaystring
    • rolestringrequiredenum custom
    • timestampinteger· int64required
    Variant 4
    • contentone of[]required
      Show 7 nested
      one of (7)
      Variant 1
      • textstringrequired
      • typestringrequiredenum text
      Variant 2
      • attachment_idstring

        Optional link to the stored original in the session-manager attachment store. Transcript bookkeeping for lazy readers only: the harness clears it before `router::chat`, and no provider mapping reads it. Tolerated here so a block that still carries it deserializes instead of failing the request; omitted on the wire when absent.

      • datastringrequired
      • mimestringrequired
      • typestringrequiredenum image
      Variant 3
      • attachment_idstringrequired
      • mimestringrequired
      • namestringrequired
      • sizeinteger· uint64requiredmin 0
      • typestringrequiredenum file
      Variant 4
      • signaturestring
      • textstringrequired
      • typestringrequiredenum thinking
      Variant 5
      • datastringrequired
      • typestringrequiredenum redacted_thinking
      Variant 6
      • argumentsunknownrequired
      • function_idstringrequired
      • idstringrequired
      • typestringrequiredenum function_call
      Variant 7
      • contentunknown[]required
      • function_call_idstringrequired
      • is_errorboolean
      • typestringrequiredenum function_result
    • rolestringrequiredenum user

      Single-variant role tags: exact-match on deserialize, correct wire string on serialize, and they let `AgentMessage` be an untagged union.

    • timestampinteger· int64required
  • modelstringrequired

    Model id the prompt targets; selects the tokenizer (o200k_base for gpt-4o/gpt-5/o-series and anything unknown-modern, cl100k_base for gpt-3.5 and non-o gpt-4 families).

  • system_promptstring

    System prompt counted as its own wire message when present.

  • toolsobject[]

    Function invocation schemas; each serialized schema counts toward the total.

    • descriptionstringrequired
    • execution_modestring
    • labelstring
    • namestringrequired
    • parametersunknownrequired
Response
  • estimatorstringrequired

    Always `tiktoken`: a local tokenizer produced the estimate.

  • modelstringrequired
  • tokensinteger· uint64requiredmin 0

    Estimated prompt tokens for the assembled request.

provider::openai::embed

Function

Batch text embeddings via the OpenAI embeddings endpoint, using the router-resolved credential. One vector per input, order preserved. Default model text-embedding-3-small.

Request
  • inputstring[]required

    Texts to embed, one vector returned per input, order preserved.

  • modelstring

    Embedding model id; the provider default when omitted.

Response
  • embeddingsnumber[][]required

    One embedding per input, in input order.

  • modelstringrequired

provider::openai::image::generate

Function

Generate one image from a text prompt with gpt-image-2.5-sunburst or gpt-image-2.5-flare (OpenAI Images API, router-resolved credential). Returns viewable content blocks (image + caption) that render inline, and saves the file under data/provider-openai/images/ (details.path) for other processes to pick up.

Request
  • backgroundstring

    `transparent`, `opaque`, or `auto`; transparency needs png or webp.

  • file_namestring

    File stem for the persisted image (letters, digits, `.`, `_`, `-`; anything else becomes `-`). A timestamp and a random suffix are always appended so files never collide. Defaults to `image`.

  • inlinestring

    Whether the result embeds image bytes: `none` (default — the file is saved, `details.path` names it, and the console fetches its own preview), `preview` (a JPEG at most 512px / ~80 KB, for an agent that must look at the picture; fits the harness result cap), or `full` (the original bytes — over a megabyte for a 1024px PNG).

  • modelstringrequired

    Image model: `gpt-image-2.5-sunburst` or `gpt-image-2.5-flare`.

  • output_formatstring

    `png` (default), `jpeg`, or `webp`: the format of the file saved under data/ (and of the inline picture when `inline` is `full`).

  • promptstringrequired

    What to draw (up to 32k characters).

  • qualitystring

    `low`, `medium`, `high`, or `auto`; the model default when omitted.

  • sizestring

    `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto`; the model default when omitted.

Response
  • contentobject[]required

    `[image block, text line]` (`[text line]` with `inline: none`) — render `content` and the picture shows.

    • datastring
    • mimestring
    • textstring
    • typestringrequired
  • detailsobjectrequired
    • bytesinteger· uint64requiredmin 0

      Saved file size in bytes.

    • heightinteger· uint32min 0

      Pixel height of the saved file, when decodable.

    • inlinestringrequired

      `preview`, `full`, or `none`: what the inline image block carries.

    • mimestringrequired

      Mime of the saved file: `image/png`, `image/jpeg`, or `image/webp`.

    • modelstringrequired

      Image model that produced the picture.

    • pathstringrequired

      Absolute path of the full-resolution file under `data/provider-openai/images/`.

    • previewany of

      Present when `inline` is `preview` and the preview could be built.

      any of (2)
      Variant 1
      • bytesinteger· uint64requiredmin 0
      • heightinteger· uint32requiredmin 0
      • mimestringrequired
      • widthinteger· uint32requiredmin 0
      Variant 2
      valuenull
    • qualitystringrequired

      Requested quality (`auto` when left to the model).

    • revised_promptstring

      The prompt as the model actually rendered it, when upstream reports one.

    • sizestringrequired

      Requested size (`auto` when left to the model).

    • usageany of
      any of (2)
      Variant 1
      • input_tokensinteger· uint64min 0
      • output_tokensinteger· uint64min 0
      • total_tokensinteger· uint64min 0
      Variant 2
      valuenull
    • widthinteger· uint32min 0

      Pixel width of the saved file, when decodable.

provider::openai::image::read

Function

Read back an image saved by image::generate (its details.path or bare file name under data/provider-openai/images/) as viewable content blocks: a JPEG preview (default, fits the harness result cap) or the full bytes. Refuses any path outside that folder.

Request
  • pathstringrequired

    Absolute path returned by `image::generate`, or the bare file name inside `data/provider-openai/images/`.

  • variantstring

    `preview` (default; a JPEG at most 512px / ~80 KB that fits the harness result cap) or `full` (the saved bytes as they are).

Response
  • contentobject[]required

    `[image block, text line]` — the same viewable envelope as generate.

    • datastring
    • mimestring
    • textstring
    • typestringrequired
  • detailsobjectrequired
    • bytesinteger· uint64requiredmin 0

      Saved file size in bytes.

    • heightinteger· uint32min 0
    • mimestringrequired

      Mime of the saved file.

    • pathstringrequired

      Absolute path of the file that was read.

    • previewany of
      any of (2)
      Variant 1
      • bytesinteger· uint64requiredmin 0
      • heightinteger· uint32requiredmin 0
      • mimestringrequired
      • widthinteger· uint32requiredmin 0
      Variant 2
      valuenull
    • variantstringrequired

      `preview` or `full`: what the image block carries.

    • widthinteger· uint32min 0

provider::openai::on_router_ready

Function

Internal: router::ready subscriber that re-declares this provider and refreshes its catalog.

Request
Empty object
Response
  • okbooleanrequired

provider::openai::refresh_models

Function

Refresh the OpenAI catalog slice from GET /v1/models and reconcile it through the router; returns the model count written.

Request
Empty object
Response
  • countinteger· uintrequiredmin 0
  • okbooleanrequired

provider::openai::stream

Function

Stream an OpenAI response: resolve credentials, call the configured Responses or Chat Completions endpoint, and relay AssistantMessageEvent frames to writer_ref.

Request
  • cache_intentany of
    any of (2)
    Variant 1
    • surface_digeststringrequired
    Variant 2
    valuenull
  • max_output_tokensinteger· uint64min 0
  • messagesany of[]required
    any of (4)
    Variant 1
    • contentone of[]required
      Show 7 nested
      one of (7)
      Variant 1
      • textstringrequired
      • typestringrequiredenum text
      Variant 2
      • attachment_idstring

        Optional link to the stored original in the session-manager attachment store. Transcript bookkeeping for lazy readers only: the harness clears it before `router::chat`, and no provider mapping reads it. Tolerated here so a block that still carries it deserializes instead of failing the request; omitted on the wire when absent.

      • datastringrequired
      • mimestringrequired
      • typestringrequiredenum image
      Variant 3
      • attachment_idstringrequired
      • mimestringrequired
      • namestringrequired
      • sizeinteger· uint64requiredmin 0
      • typestringrequiredenum file
      Variant 4
      • signaturestring
      • textstringrequired
      • typestringrequiredenum thinking
      Variant 5
      • datastringrequired
      • typestringrequiredenum redacted_thinking
      Variant 6
      • argumentsunknownrequired
      • function_idstringrequired
      • idstringrequired
      • typestringrequiredenum function_call
      Variant 7
      • contentunknown[]required
      • function_call_idstringrequired
      • is_errorboolean
      • typestringrequiredenum function_result
    • error_kindany of
      Show 2 nested
      any of (2)
      Variant 1
      valuestringenum auth_expired, rate_limited, context_overflow, transient, permanent
      Variant 2
      valuenull
    • error_messagestring
    • modelstringrequired
    • native_stop_reasonstring
    • providerstringrequired
    • rolestringrequiredenum assistant
    • stop_reasonstringrequiredenum end, length, function_call, aborted, error
    • timestampinteger· int64required
    • usageany of
      Show 2 nested
      any of (2)
      Variant 1
      • cache_readinteger· uint64min 0
      • cache_writeinteger· uint64min 0
      • cost_usdnumber· double
      • inputinteger· uint64min 0
      • outputinteger· uint64min 0
      • reasoninginteger· uint64min 0
      Variant 2
      valuenull
    • warningsstring[]
    Variant 2
    • contentone of[]required
      Show 7 nested
      one of (7)
      Variant 1
      • textstringrequired
      • typestringrequiredenum text
      Variant 2
      • attachment_idstring

        Optional link to the stored original in the session-manager attachment store. Transcript bookkeeping for lazy readers only: the harness clears it before `router::chat`, and no provider mapping reads it. Tolerated here so a block that still carries it deserializes instead of failing the request; omitted on the wire when absent.

      • datastringrequired
      • mimestringrequired
      • typestringrequiredenum image
      Variant 3
      • attachment_idstringrequired
      • mimestringrequired
      • namestringrequired
      • sizeinteger· uint64requiredmin 0
      • typestringrequiredenum file
      Variant 4
      • signaturestring
      • textstringrequired
      • typestringrequiredenum thinking
      Variant 5
      • datastringrequired
      • typestringrequiredenum redacted_thinking
      Variant 6
      • argumentsunknownrequired
      • function_idstringrequired
      • idstringrequired
      • typestringrequiredenum function_call
      Variant 7
      • contentunknown[]required
      • function_call_idstringrequired
      • is_errorboolean
      • typestringrequiredenum function_result
    • detailsunknownrequired
    • function_call_idstringrequired
    • function_idstringrequired
    • is_errorbooleanrequired
    • rolestringrequiredenum function_result
    • timestampinteger· int64required
    Variant 3
    • contentone of[]required
      Show 7 nested
      one of (7)
      Variant 1
      • textstringrequired
      • typestringrequiredenum text
      Variant 2
      • attachment_idstring

        Optional link to the stored original in the session-manager attachment store. Transcript bookkeeping for lazy readers only: the harness clears it before `router::chat`, and no provider mapping reads it. Tolerated here so a block that still carries it deserializes instead of failing the request; omitted on the wire when absent.

      • datastringrequired
      • mimestringrequired
      • typestringrequiredenum image
      Variant 3
      • attachment_idstringrequired
      • mimestringrequired
      • namestringrequired
      • sizeinteger· uint64requiredmin 0
      • typestringrequiredenum file
      Variant 4
      • signaturestring
      • textstringrequired
      • typestringrequiredenum thinking
      Variant 5
      • datastringrequired
      • typestringrequiredenum redacted_thinking
      Variant 6
      • argumentsunknownrequired
      • function_idstringrequired
      • idstringrequired
      • typestringrequiredenum function_call
      Variant 7
      • contentunknown[]required
      • function_call_idstringrequired
      • is_errorboolean
      • typestringrequiredenum function_result
    • custom_typestringrequired
    • detailsunknown
    • displaystring
    • rolestringrequiredenum custom
    • timestampinteger· int64required
    Variant 4
    • contentone of[]required
      Show 7 nested
      one of (7)
      Variant 1
      • textstringrequired
      • typestringrequiredenum text
      Variant 2
      • attachment_idstring

        Optional link to the stored original in the session-manager attachment store. Transcript bookkeeping for lazy readers only: the harness clears it before `router::chat`, and no provider mapping reads it. Tolerated here so a block that still carries it deserializes instead of failing the request; omitted on the wire when absent.

      • datastringrequired
      • mimestringrequired
      • typestringrequiredenum image
      Variant 3
      • attachment_idstringrequired
      • mimestringrequired
      • namestringrequired
      • sizeinteger· uint64requiredmin 0
      • typestringrequiredenum file
      Variant 4
      • signaturestring
      • textstringrequired
      • typestringrequiredenum thinking
      Variant 5
      • datastringrequired
      • typestringrequiredenum redacted_thinking
      Variant 6
      • argumentsunknownrequired
      • function_idstringrequired
      • idstringrequired
      • typestringrequiredenum function_call
      Variant 7
      • contentunknown[]required
      • function_call_idstringrequired
      • is_errorboolean
      • typestringrequiredenum function_result
    • rolestringrequiredenum user

      Single-variant role tags: exact-match on deserialize, correct wire string on serialize, and they let `AgentMessage` be an untagged union.

    • timestampinteger· int64required
  • modelstringrequired
  • model_metaany of
    any of (2)
    Variant 1
    • context_windowinteger· uint64requiredmin 0
    • display_namestring
    • idstringrequired
    • input_limitinteger· uint64min 0
    • max_output_tokensinteger· uint64requiredmin 0
    • pricingany of
      Show 2 nested
      any of (2)
      Variant 1
      • cache_readnumber· double
      • cache_writenumber· double
      • inputnumber· double
      • outputnumber· double
      Variant 2
      valuenull
    • providerstringrequired
    • reasoning_effortsobject[]
      Show 2 nested
      • descriptionstring
      • effortstringrequired
    • speechany of

      Set on speech models only; see [`SpeechModel`].

      Show 2 nested
      any of (2)
      Variant 1
      • languagesstring[]

        BCP-47 tags of the languages the model handles; empty when the provider does not say.

      • modalityone ofrequired

        What a speech model does. Chat models carry no `speech` block.

        Show 2 nested
        one of (2)
        Variant 1
        valuestringenum stt
        Variant 2
        valuestringenum tts
      • streamingboolean

        Realtime input (stt) or streamed audio output (tts) is available.

      Variant 2
      valuenull
    • supports_cacheboolean
    • supports_structured_outputboolean
    • supports_thinkingboolean
    • supports_toolsboolean
    • supports_visionboolean
    • supports_xhighboolean
    • thinking_budgetsobject
    Variant 2
    valuenull
  • provider_optionsunknown
  • resolution_keystring
  • response_formatany of
    any of (2)
    Variant 1
    • schemaunknown
    • typestringrequired
    Variant 2
    valuenull
  • session_idstring

    Stable conversation identity for provider cache affinity.

  • system_promptstring
  • system_sectionsobject[]

    Ordered sections behind `system_prompt` (always forwarded alongside the flat string, which equals the sections joined with "\n\n").

    • cache_boundaryboolean
    • textstringrequired
  • thinking_levelany of
    any of (2)
    Variant 1
    valuestringenum minimal, low, medium, high, xhigh
    Variant 2
    valuenull
  • toolsobject[]
    • descriptionstringrequired
    • execution_modestring
    • labelstring
    • namestringrequired
    • parametersunknownrequired
  • writer_refobjectrequired
    • access_keystringrequired
    • channel_idstringrequired
    • directionstringrequiredenum read, write
Response
  • okbooleanrequired

Triggers0

No triggers registered

Search the registry

Find workers, kits and executables, or jump to a page.