provider::openai::abort
Cancel the in-flight upstream stream for a request_id (router::abort fan-out), stopping billed generation immediately.
- request_idstringrequired
- abortedbooleanrequired
OpenAI Responses provider worker with Chat Completions compatibility; implements provider::openai::stream and provider::openai::refresh_models behind llm-router.
exact versions are immutable; binary and bundle artifacts are digest-pinned.
Cancel the in-flight upstream stream for a request_id (router::abort fan-out), stopping billed generation immediately.
Count prompt tokens for {model, system_prompt?, tools?, messages} locally with the tiktoken tokenizers; never runs the model and costs nothing.
Wire agent messages, the same shape `provider::openai::stream` accepts. Must be non-empty.
Single-variant role tags: exact-match on deserialize, correct wire string on serialize, and they let `AgentMessage` be an untagged union.
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 prompt counted as its own wire message when present.
Function invocation schemas; each serialized schema counts toward the total.
Always `tiktoken`: a local tokenizer produced the estimate.
Estimated prompt tokens for the assembled request.
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.
Texts to embed, one vector returned per input, order preserved.
Embedding model id; the provider default when omitted.
One embedding per input, in input order.
Internal: router::ready subscriber that re-declares this provider and refreshes its catalog.
Refresh the OpenAI catalog slice from GET /v1/models and reconcile it through the router; returns the model count written.
Stream an OpenAI response: resolve credentials, call the configured Responses or Chat Completions endpoint, and relay AssistantMessageEvent frames to writer_ref.
Single-variant role tags: exact-match on deserialize, correct wire string on serialize, and they let `AgentMessage` be an untagged union.