API lesson 01 · Read the API contract
Shared system · deterministic provider fixtures
Harbor Support Drafting API. One bounded request moves through typed items, tools, state, budgets, and evidence without live provider calls.
01 · Smallest useful mechanism
Modern LLM APIs can return text, refusals, tool proposals, tool results, usage, and intermediate events. Your application should preserve and interpret those items before rendering a final answer.
The final text is one projection of a richer protocol trace.
02 · Experiment
Deterministic protocol fixture
This workbench uses inspectable provider-event fixtures and injected failures. It does not make live calls or execute external effects.
Protocol workbench · harbor-request-v1
Injected failure
The response contains a draft and a tool call, then ends as incomplete.
The trace has not run.
Commit to an implementation, then inject the failure and inspect the actual state transitions.
03 · Implementation brief
Your learning artifact
Stored only in this browser. No account required; course reset does not delete it.
04 · Check your understanding
Primary sources · verified 2026-08-02
Flattening a response into text discards the evidence needed for safe tools, retries, debugging, cost attribution, and provider portability.
Common mistake: If response text is non-empty, the request succeeded. Useful text can accompany truncation, refusal, tool use, or an incomplete operation. Success depends on the terminal state and product contract.
Transfer exercise: Compare the same request as raw OpenAI, Anthropic, and Gemini fixtures; map each item to one internal event vocabulary.
Next: Once the item contract is explicit, streaming becomes a sequence of typed state transitions rather than animated text.