llmadapter

Public API Surface

This document records the v1 package-boundary decision for llmadapter. It is intended to prevent accidental public API expansion after the release-candidate baseline.

Stable Consumer Packages

These packages are the primary v1 surface for library consumers:

Extension Packages

These packages are public because advanced users and provider implementers need them:

Internal Packages

These packages are intentionally not public API:

Keep new cross-package helpers internal unless there is a clear external implementation need.

Stability Rules

Continuation Boundary

unified.RouteEvent.ConsumerContinuation is the public projection contract for consumers. ProviderExecutionEvent.InternalContinuation and Transport are diagnostics for what happened inside a provider endpoint during a turn.

Codex WebSocket continuation does not change the public API surface: consumers still send full replay-style requests to codex_responses, while the provider may internally use WebSocket and previous_response_id after same-session/same-branch lineage checks pass. Do not add consumer branching logic based on provider name, API family, Transport, or InternalContinuation.

unified.AssistantMessageFromResponse is a stateless helper for replay-style tool continuation. It copies the collected assistant content/reasoning and tool calls into a unified.Message; it does not make llmadapter own conversation state.

unified.Message.Phase, unified.Response.Phase, unified.MessageStartEvent.Phase, and unified.MessageDoneEvent.Phase preserve provider-supplied assistant message phase metadata such as OpenAI Responses commentary and final_answer. Empty phase means unknown/legacy behavior. Codecs only encode phase where the target wire API supports assistant message phases.

Quota Telemetry

Providers can emit unified.QuotaUsageEvent when an upstream reports subscription or quota-window usage. The event is observational metadata for library consumers; it does not affect routing, retry, or request projection. unified.Collect preserves quota snapshots in Response.Quotas.

Codex maps x-codex-primary-used-percent, x-codex-secondary-used-percent, and related window/reset headers into primary and secondary quota windows. Claude-compatible access maps live anthropic-ratelimit-unified-5h-* and anthropic-ratelimit-unified-7d-* headers into the same primary and secondary session windows. Anthropic API-key access maps documented anthropic-ratelimit-* headers into request/token quota windows with limit, remaining, reset, and derived used-percent fields. Providers with similar subscription models should map their native telemetry into the same event rather than exposing provider-specific headers directly; provider-specific labels and statuses remain in ProviderRaw.

V1 Review Result

No exported renames are required from the current surface before v1.0.0 promotion. The potentially confusing pieces have explicit boundaries: