OpenAICompatProvider — one class, one configured instance per lane.
Purpose
-------
Concrete :class:`ProviderPlugin` for any OpenAI-compatible lane. Unlike
the single-provider bundles, this class is NOT configured by class
attributes: each instance is built from a :class:`Lane` catalogue row, so
seven rows produce seven independently-named providers backed by one
implementation (plan 215 P1). The registry keys on ``name`` and only
rejects a DIFFERENT class re-using an existing name, so registering one
class under seven names is exactly what its contract allows.
Responsibilities
----------------
- :class:`OpenAICompatProvider` — implement the abstract surface from a
lane row.
- :meth:`OpenAICompatProvider.register_lane` — build and register one
instance for a row.
- :func:`register_all` — validate the catalogue, then register every row.
- :func:`registered_lanes` — the lane rows this bundle registered, in
catalogue declaration order.
Diagnostics
-----------
Domain: OC_CHAT.CLIENT
Levels:
L2 — lifecycle events
L3 — semantic details
L4 — deep tracing
Contracts
---------
- Identity (``name`` / ``api_key_env_var`` / ``base_url_env_var`` /
``default_base_url`` / ``default_model``) is set per INSTANCE from the
row, shadowing the ABC's class-level defaults. Two instances never
share mutable state.
- :meth:`build_extra_body` returns ``None`` always: no catalogue lane is
configured for reasoning (the OCON as-shipped condition), so there is
no provider-specific payload to add. A lane that later needs one adds
it here keyed on its own name — never a blanket default.
- :meth:`transform_outgoing_messages` is a true pass-through: no lane has
a prefix-cache trick to serve.
- :meth:`parse_usage` delegates to :func:`normalise_usage`, which is
total over malformed input.
- :func:`register_all` is idempotent and validates FIRST: an invalid row
raises :exc:`CatalogueError` before ANY lane is registered, so a
half-registered bundle is unreachable (plan 215 P5).
- Nothing here reads an API key. The harness resolves the key from the
env-var NAME this provider advertises.
Dependencies
------------
- oc_diagnostics (structured debug logging via _dbg)
- option_c_agent_contracts (ProviderPlugin ABC, ModelCaps, UsageStats, registry)
- option_c_agent_contracts.provider_plugin (OAuthCapability return type of the oauth property)
- providers.openai_compat.catalogue (LANES, Lane rows and validate_catalogue for register_all)
- providers.openai_compat.client (OpenAICompatClient returned by build_client)
- providers.openai_compat.usage (normalise_usage behind parse_usage)
- providers.openai_compat.oauth (lazy; OpenRouterOAuth for the openrouter lane's oauth property)