Documentation
¶
Overview ¶
Package openai adapts an OpenAI Chat Completions endpoint (OpenAI itself, a vLLM server, or an internal OpenAI-compatible gateway) to the provider interface. Unlike the anthropic adapter, which is near-verbatim, this is the platform's lossy seam: the internal Request is Anthropic-native, so every turn is translated to OpenAI wire on the way out and back on the way in. All of that conversion is confined here and tested against a fake Chat Completions server.
base_url is the API root, the same convention as the anthropic provider: the adapter appends /v1/chat/completions. Set it to e.g. https://api.openai.com or https://vllm.internal, NOT .../v1.
Known lossy gaps (documented, not silent): Anthropic thinking blocks have no Chat Completions equivalent and are dropped; image blocks are not yet mapped and an unsupported block (top-level or inside a tool_result) fails loudly rather than vanishing; a tool_result's is_error flag is dropped (OpenAI's tool message has no error field) — the error text the platform embeds in the result content is still forwarded, so the model sees the failure, only the boolean is lost. Incoming, the deprecated single-function_call streaming format is rejected loudly (the endpoint must emit tool_calls) rather than silently losing the call.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.