---
title: "HTTP model adapter: typed responses and token metering"
description: Select a typed view of an OpenAI Responses result, retain original
  token measurements by job and session, and distinguish absent usage from an
  observed zero.
url: https://docs.rastok.com/examples/08-model-adapter
source_revision: v0.2.0-alpha
---

# HTTP model adapter: typed responses and token metering

This program sends a model request and keeps the response's reported usage with its job and session.

A bounded loop tells you how much work may repeat. At a model boundary,
another question matters: what usage did the partner actually report?
Keep that evidence on the original typed response, without turning an absent
field into a zero or counting a downstream copy again.

The [file formats](/guide/09-command-line.md#file-formats) are `.rkg` for
the program and Lab, `.rkc` for a reviewed scenario reference and `.rkr`
for a real execution recording.

## Run

From the repository root, use the synthetic fixture bindings and the checked
[deployment profile](https://github.com/rastok-io/rastok/blob/2e5128c76faf35cc879211138f429a4048608c77/examples/agent-http.deployment.json):

```sh
RASTOK_SHOWCASE_MODEL_TOKEN=lab-only-not-a-credential RASTOK_SHOWCASE_MODEL_TOKEN_VERSION=fixture-v1 rastok simulate examples/agent-http.rkg --deployment examples/agent-http.deployment.json --compare examples/traces/agent-http
```

```text
PASS responses.two_sessions
PASS responses.missing_usage
PASS responses.observed_zero
PASS responses.schema_failure
PASS responses.transport_failure
PASS responses.http_errors
6 scenario(s), 0 failed
```

Add `--ui` for the paused debugger.

```sh
RASTOK_SHOWCASE_MODEL_TOKEN=lab-only-not-a-credential RASTOK_SHOWCASE_MODEL_TOKEN_VERSION=fixture-v1 rastok simulate examples/agent-http.rkg --deployment examples/agent-http.deployment.json --compare examples/traces/agent-http --ui
```

This requires `hosted-ui`. Open the private loopback URL printed by the CLI. The Lab never contacts the profile's
configured model URL. These fixture values are not credentials.

For the controls and source view, see [the debugger tour](/debugger.md).

## Read the program

Start with `ResponseUsage` and `ModelResponse`. The former marks the three
original quantities with `@measure(id = ..., unit = "token")`. The latter
is an explicit selected view of an external JSON object: response identity,
output, status, usage and error.

The `model` [HttpClient](/reference/connectors/http-client.md) refines its existing port with `output out: ModelResponse`.
Under `codec = json` and `json_profile = projected`, deserialization keeps
declared members, omits additional members and turns an absent nullable
member into null. A member with the wrong type produces `DecodeFailed`;
its `message` names the field and the expected type without copying the
received value.
Ordinary structs and strict JSON deserialization remain closed.

`request` carries `session` and `job` into META. `explain_usage` emits an
explanation when usage is absent; it neither extracts nor sums measurements.
`terminal` separates a usable 2xx response from other HTTP outcomes. One job
means one non-streaming inference, not a resident conversation.

The bearer is a logical `secret("showcase/model/token")` reference. Its value
is bound at boot and supplied only at the real HttpClient Driver boundary.
`behavior = probabilistic` describes the partner's outputs. It does not mean
that repeating a request is safe: there is no Retry on this inference.

The [Lab reference](/reference/lab.md) explains mock responses, expectations
and observation windows. `advance` supplies virtual time; a mock's terminal
response ends its simulated exchange, not the whole scenario.

<a id="graph"></a>

Source: `examples/agent-http.rkg`

```rkg
// Each job makes one HTTP request and reports the usage in the model's reply.
// The Lab scripts replies; the graph never retries a potentially billable request.
val model_name = "gpt-6-astra"
val simulated_message = json! {"type":"message","role":"assistant","content":[{"type":"output_text","text":"Hello from the simulated model.","annotations":[]}]}

type Job = struct { session: string, job: string, prompt: string }
type JsonObject = map<string, variant>
type ResponseUsage = struct {
  input_tokens: ulong @measure(id = input_tokens, unit = "token")
  output_tokens: ulong @measure(id = output_tokens, unit = "token")
  total_tokens: ulong @measure(id = total_tokens, unit = "token")
  input_tokens_details: JsonObject?
  output_tokens_details: JsonObject?
}
type ModelResponse = struct {
  id: string
  object: string
  output: array<variant>
  status: string?
  usage: ResponseUsage?
  error: JsonObject?
}
type UnknownUsage = struct { session: string, job: string, reason: string }

graph agent_http : App {
  input in: Job
  output response: ModelResponse
  output unknown: UnknownUsage
  output failed: HttpClientExit
  instance = { key = data.session }
  lifetime = { kind = idle; max = duration("2h") }
  closing = { drain_for = duration("30s"); settle_for = duration("5s") }

  operator request {
    input in: Job
    output out: variant
    on in {
      val body = { model = model_name; input = data.prompt; stream = false; store = false; max_output_tokens = 128 }
      out = {
        data = body as variant
        meta.app.session = data.session
        meta.app.job = data.job
      }
    }
  }
  connector model : HttpClient {
    url = env("MODEL_URL")
    auth_bearer = secret("showcase/model/token")
    method = "POST"
    codec = json
    json_profile = projected
    output out: ModelResponse
    timeout = duration("10s")
    max_body = "256 KiB"
    behavior = probabilistic
  }
  // Quantities already live on model.out. This Operator only explains absence;
  // it neither extracts, copies nor totals measurements.
  operator explain_usage {
    input in: ModelResponse
    output unknown: UnknownUsage
    on in match {
      data.usage is ResponseUsage => nothing
      _ => unknown = { session = meta.app.session as string; job = meta.app.job as string; reason = "usage not reported" }
    }
  }
  operator terminal {
    input in: HttpClientExit
    output failed: HttpClientExit
    output unknown: UnknownUsage
    on in match {
      data is Completed => match {
        data.status >= 200 && data.status < 300 => nothing
        _ => failed = Completed { status = data.status }
      }
      data is ServerError => failed = ServerError { status = data.status }
      _ => {
        failed = .
        unknown = { session = meta.app.session as string; job = meta.app.job as string; reason = "no usable response" }
      }
    }
  }

  in -> request -> model
  model.out -> { response; explain_usage }
  explain_usage.unknown -> unknown
  // Lost answers go to the same handler, which reports the unknown usage.
  model.exit -> match {
    BodyTooLarge | DecodeFailed | OutcomeUnknown | ProtocolFailed | TimeoutExpired -> terminal
    Completed | ConnectFailed | DnsFailed | ServerError | TlsFailed -> terminal
  }
  terminal.failed -> failed
  terminal.unknown -> unknown
}

lab responses {
  // Mocks supply already typed values. Wire-shape refusals are separately
  // tested against the real HTTP decoder, not inferred from this Lab.
  mock model {
    on in match {
      meta.app.job == "missing" || meta.app.job == "null" => {
        out = { id = "resp_without_usage"; object = "response"; output = []; status = "completed"; usage = null; error = null }
        exit = Completed { status = 200 }
      }
      meta.app.job == "invalid" => exit = DecodeFailed { message = "response `out.usage.total_tokens` expects ulong; received string" }
      meta.app.job == "error_body" => exit = DecodeFailed { message = "response `out.id` expects string; required member is missing" }
      meta.app.job == "zero" => {
        out = { id = "resp_zero"; object = "response"; output = []; status = "completed"; usage = { input_tokens = 0u; output_tokens = 0u; total_tokens = 0u; input_tokens_details = null; output_tokens_details = null }; error = null }
        exit = Completed { status = 200 }
      }
      meta.app.job == "timeout" => nothing
      meta.app.job == "server_error" => {
        out = { id = "resp_failed"; object = "response"; output = []; status = "failed"; usage = null; error = {"message": "scripted service error"} }
        exit = ServerError { status = 500 }
      }
      _ => {
        out = {
          id = "resp_fixture"
          object = "response"
          output = [simulated_message]
          status = "completed"
          usage = { input_tokens = 12u; output_tokens = 4u; total_tokens = 16u; input_tokens_details = {"cached_tokens": 0}; output_tokens_details = {"reasoning_tokens": 0} }
          error = null
        }
        exit = Completed { status = 200 }
      }
    }
  }
  scenario two_sessions {
    app.in = { session = "alice"; job = "a1"; prompt = "Hello" }
    expect model.out where meta.app.session == "alice" && meta.app.job == "a1"
    app.in = { session = "bob"; job = "b1"; prompt = "Hello" }
    expect model.out where meta.app.session == "bob" && meta.app.job == "b1"
    app.in = { session = "alice"; job = "a2"; prompt = "Another independent job" }
    expect model.out where meta.app.session == "alice" && meta.app.job == "a2"
    expect app.unknown == nothing
    expect app.failed == nothing
  }
  scenario missing_usage {
    app.in = { session = "alice"; job = "missing"; prompt = "Hello" }
    expect app.unknown where data.reason == "usage not reported"
    app.in = { session = "alice"; job = "null"; prompt = "Hello" }
    expect app.unknown where data.reason == "usage not reported"
    expect app.failed == nothing
  }
  scenario observed_zero {
    app.in = { session = "alice"; job = "zero"; prompt = "Hello" }
    expect model.out where data.usage is ResponseUsage && data.usage.input_tokens == 0u && data.usage.output_tokens == 0u && data.usage.total_tokens == 0u
    expect app.unknown == nothing
  }
  scenario schema_failure {
    app.in = { session = "bob"; job = "invalid"; prompt = "Hello" }
    expect app.failed where data is DecodeFailed && data.message.contains("out.usage.total_tokens")
    expect app.unknown
    expect model.out == nothing
  }
  scenario transport_failure {
    app.in = { session = "alice"; job = "timeout"; prompt = "Hello" }
    advance duration("10s")
    expect app.failed == TimeoutExpired {}
    expect app.unknown
    expect model.out == nothing
  }
  scenario http_errors {
    app.in = { session = "alice"; job = "server_error"; prompt = "Hello" }
    expect app.failed where data is ServerError && data.status == 500
    expect model.out
    app.in = { session = "alice"; job = "error_body"; prompt = "Hello" }
    expect app.failed where data is DecodeFailed && data.message.contains("out.id")
    expect model.out == nothing
  }
}
```

## Expected result

The CLI ends with `6 scenario(s), 0 failed`:

| Scenario | Evidence |
|---|---|
| `two_sessions` | Alice's two jobs and Bob's job retain their own session and original response; each fixture reports 12 input, 4 output and 16 total tokens |
| `missing_usage` | Absent/null usage produces an explanation and no measurement sample |
| `observed_zero` | Three explicitly reported zero quantities remain observations |
| `schema_failure` | `DecodeFailed` supplies no partially usable `model.out` |
| `transport_failure` | A ten-second logical timeout produces no usage and no repeated inference |
| `http_errors` | A decoded 500 is `ServerError`; an incompatible error body is `DecodeFailed` |

The three token quantities are separate facts, not three numbers to add
together. Input plus output already accounts for the reported total in this
fixture; the graph invents neither a monetary amount nor a missing quantity.

## Break it

In the `simulated_message` constant, change `Hello from the simulated model.`
to `A different model answer.`. Keep the expected trace unchanged and run
the comparison below. The counts still match, but `responses.two_sessions`
fails its golden comparison. The other five scenarios still pass.

```sh
RASTOK_SHOWCASE_MODEL_TOKEN=lab-only-not-a-credential RASTOK_SHOWCASE_MODEL_TOKEN_VERSION=fixture-v1 rastok simulate examples/agent-http.rkg --deployment examples/agent-http.deployment.json --compare examples/traces/agent-http
```

```text
FAIL responses.two_sessions
     golden divergence: record 6: closure(32)[1][0][1][1]; expected 820f868265657272…(399 bytes); got 820f868265657272…(393 bytes); cause: EGRESS "model" · emitting_id 7c6e92c8de6b86d2…(16 bytes) · call_key absent
PASS responses.missing_usage
PASS responses.observed_zero
PASS responses.schema_failure
PASS responses.transport_failure
PASS responses.http_errors
6 scenario(s), 1 failed
```

Restore the checked-in source (this discards your edits to this example):

```sh
git checkout -- examples/agent-http.rkg
```

## Read the golden difference

The measured first divergence is `record 6: closure(32)[1][0][1][1]`:
the expected encoded value has 399 bytes and the changed one 393 bytes.
The cause is `EGRESS "model"`, with no Call key. The differing external
response is recorded before downstream interpretation, even though the
scenario's count assertions still hold. Restore the text; do not save over
the reference to hide the changed answer.

<details id="golden" class="raw-trace">
<summary>Inspect the raw sealed trace (.rkc)</summary>

The versioned reference stores one hex-encoded causal record per line, with an optional final seal line. Use the chapter's comparison commands to explain a divergence.

Source: `examples/traces/agent-http/responses.two_sessions.rkc`

```rastok-trace
a6070108a40150f3df1105112054d397a04ed0666ca4c80350f3df1105112054d397a04ed0666ca4c80401058202582e820f8382636a6f628206626131826670726f6d707482066548656c6c6f826773657373696f6e820665616c69636509636c61620a000b000d81826e2e696e3e726571756573742e696e82581882816772657175657374818380018207820665616c69636500
a7070211601282508280818380018207820665616c6963650013676c3a737461727414801780181a50f3df1105112054d397a04ed0666ca4c8
a807021167726571756573741282581882816772657175657374818380018207820665616c6963650013676c3a737461727414801780181a50f3df1105112054d397a04ed0666ca4c8182282508280818380018207820665616c69636500
a807021167726571756573741282581882816772657175657374818380018207820665616c696365001364703a696e1481836e2e696e3e726571756573742e696e82508280818380018207820665616c6963650001178183636f757400a601507c6e92c8de6b86d2cd0b2595345189fe0250f3df1105112054d397a04ed0666ca4c80350f3df1105112054d397a04ed0666ca4c804010582025853820f858265696e70757482066548656c6c6f82716d61785f6f75747075745f746f6b656e738202188082656d6f64656c82066b6770742d362d6173747261826573746f72658201f4826673747265616d8201f406828363617070636a6f62820662613183636170706773657373696f6e820665616c6963651818818201506cef1737ef75613f4e28c116cf87754518198183507c6e92c8de6b86d2cd0b2595345189fe74726571756573742e6f75743e6d6f64656c2e696e82568281656d6f64656c818380018207820665616c69636500
a8070211656d6f64656c1282568281656d6f64656c818380018207820665616c6963650013676c3a737461727414801780181a507c6e92c8de6b86d2cd0b2595345189fe182282508280818380018207820665616c69636500
a60703181b507c6e92c8de6b86d2cd0b2595345189fe181c656d6f64656c181e5820abe16a58280893d680b03b5f8e959dec87401453a0760738fa73661b0463c913181f01182174726571756573742e6f75743e6d6f64656c2e696e
a70703181b507c6e92c8de6b86d2cd0b2595345189fe181c656d6f64656c181e5820abe16a58280893d680b03b5f8e959dec87401453a0760738fa73661b0463c913181f02182082018282636f7574820259018f820f8682656572726f72821382008207f68262696482066c726573705f6669787475726582666f626a656374820668726573706f6e736582666f757470757482118182108382820664726f6c65820669617373697374616e7482820664747970658206676d65737361676582820667636f6e74656e7482118182108382820664746578748206781f48656c6c6f2066726f6d207468652073696d756c61746564206d6f64656c2e828206647479706582066b6f75747075745f746578748282066b616e6e6f746174696f6e73821180826673746174757382138201820669636f6d706c657465648265757361676582138201820f85826c696e7075745f746f6b656e7382140c8274696e7075745f746f6b656e735f64657461696c73821382018210818282066d6361636865645f746f6b656e73820200826d6f75747075745f746f6b656e7382140482756f75747075745f746f6b656e735f64657461696c738213820182108182820670726561736f6e696e675f746f6b656e73820200826c746f74616c5f746f6b656e738214108264657869748202581c82138269436f6d706c65746564820f818266737461747573820218c8182174726571756573742e6f75743e6d6f64656c2e696e
a7070211656d6f64656c1282568281656d6f64656c818380018207820665616c696365001364703a696e14818374726571756573742e6f75743e6d6f64656c2e696e82581882816772657175657374818380018207820665616c6963650001178283636f757400a60150b50ee3bb021a25a906a15643703a0aaa02507c6e92c8de6b86d2cd0b2595345189fe0350f3df1105112054d397a04ed0666ca4c8040105820259018f820f8682656572726f72821382008207f68262696482066c726573705f6669787475726582666f626a656374820668726573706f6e736582666f757470757482118182108382820664726f6c65820669617373697374616e7482820664747970658206676d65737361676582820667636f6e74656e7482118182108382820664746578748206781f48656c6c6f2066726f6d207468652073696d756c61746564206d6f64656c2e828206647479706582066b6f75747075745f746578748282066b616e6e6f746174696f6e73821180826673746174757382138201820669636f6d706c657465648265757361676582138201820f85826c696e7075745f746f6b656e7382140c8274696e7075745f746f6b656e735f64657461696c73821382018210818282066d6361636865645f746f6b656e73820200826d6f75747075745f746f6b656e7382140482756f75747075745f746f6b656e735f64657461696c738213820182108182820670726561736f6e696e675f746f6b656e73820200826c746f74616c5f746f6b656e7382141006828363617070636a6f62820662613183636170706773657373696f6e820665616c69636583646578697400a601505c6a50d6bb594d1d03157c3a3519cb5c02507c6e92c8de6b86d2cd0b2595345189fe0350f3df1105112054d397a04ed0666ca4c80401058202581c82138269436f6d706c65746564820f818266737461747573820218c806828363617070636a6f62820662613183636170706773657373696f6e820665616c69636518198283505c6a50d6bb594d1d03157c3a3519cb5c766d6f64656c2e657869743e7465726d696e616c2e696e8258198281687465726d696e616c818380018207820665616c696365008350b50ee3bb021a25a906a15643703a0aaa781a6d6f64656c2e6f75743e6578706c61696e5f75736167652e696e82581e82816d6578706c61696e5f7573616765818380018207820665616c69636500
a80702116d6578706c61696e5f75736167651282581e82816d6578706c61696e5f7573616765818380018207820665616c6963650013676c3a737461727414801780181a50b50ee3bb021a25a906a15643703a0aaa182282508280818380018207820665616c69636500
a8070211687465726d696e616c128258198281687465726d696e616c818380018207820665616c6963650013676c3a737461727414801780181a505c6a50d6bb594d1d03157c3a3519cb5c182282508280818380018207820665616c69636500
a60702116d6578706c61696e5f75736167651282581e82816d6578706c61696e5f7573616765818380018207820665616c696365001364703a696e148183781a6d6f64656c2e6f75743e6578706c61696e5f75736167652e696e82568281656d6f64656c818380018207820665616c69636500011780
a6070211687465726d696e616c128258198281687465726d696e616c818380018207820665616c696365001364703a696e148183766d6f64656c2e657869743e7465726d696e616c2e696e82568281656d6f64656c818380018207820665616c69636500011780
a6070108a40150e6c20d6146234b74a33da1c709e86efd0350e6c20d6146234b74a33da1c709e86efd0401058202582c820f8382636a6f628206626231826670726f6d707482066548656c6c6f826773657373696f6e820663626f6209636c61620a010b000d81826e2e696e3e726571756573742e696e825682816772657175657374818380018207820663626f6200
a70702116012824e8280818380018207820663626f620013676c3a737461727414801780181a50e6c20d6146234b74a33da1c709e86efd
a8070211677265717565737412825682816772657175657374818380018207820663626f620013676c3a737461727414801780181a50e6c20d6146234b74a33da1c709e86efd1822824e8280818380018207820663626f6200
a8070211677265717565737412825682816772657175657374818380018207820663626f62001364703a696e1481836e2e696e3e726571756573742e696e824e8280818380018207820663626f620001178183636f757400a60150b312f77e5679f2bf2cf6a90512486e150250e6c20d6146234b74a33da1c709e86efd0350e6c20d6146234b74a33da1c709e86efd04010582025853820f858265696e70757482066548656c6c6f82716d61785f6f75747075745f746f6b656e738202188082656d6f64656c82066b6770742d362d6173747261826573746f72658201f4826673747265616d8201f406828363617070636a6f62820662623183636170706773657373696f6e820663626f62181881820150fd9b99717f323d91d5cf80e3988108a61819818350b312f77e5679f2bf2cf6a90512486e1574726571756573742e6f75743e6d6f64656c2e696e82548281656d6f64656c818380018207820663626f6200
a8070211656d6f64656c1282548281656d6f64656c818380018207820663626f620013676c3a737461727414801780181a50b312f77e5679f2bf2cf6a90512486e151822824e8280818380018207820663626f6200
a60703181b50b312f77e5679f2bf2cf6a90512486e15181c656d6f64656c181e5820abe16a58280893d680b03b5f8e959dec87401453a0760738fa73661b0463c913181f01182174726571756573742e6f75743e6d6f64656c2e696e
a70703181b50b312f77e5679f2bf2cf6a90512486e15181c656d6f64656c181e5820abe16a58280893d680b03b5f8e959dec87401453a0760738fa73661b0463c913181f02182082018282636f7574820259018f820f8682656572726f72821382008207f68262696482066c726573705f6669787475726582666f626a656374820668726573706f6e736582666f757470757482118182108382820664726f6c65820669617373697374616e7482820664747970658206676d65737361676582820667636f6e74656e7482118182108382820664746578748206781f48656c6c6f2066726f6d207468652073696d756c61746564206d6f64656c2e828206647479706582066b6f75747075745f746578748282066b616e6e6f746174696f6e73821180826673746174757382138201820669636f6d706c657465648265757361676582138201820f85826c696e7075745f746f6b656e7382140c8274696e7075745f746f6b656e735f64657461696c73821382018210818282066d6361636865645f746f6b656e73820200826d6f75747075745f746f6b656e7382140482756f75747075745f746f6b656e735f64657461696c738213820182108182820670726561736f6e696e675f746f6b656e73820200826c746f74616c5f746f6b656e738214108264657869748202581c82138269436f6d706c65746564820f818266737461747573820218c8182174726571756573742e6f75743e6d6f64656c2e696e
a7070211656d6f64656c1282548281656d6f64656c818380018207820663626f62001364703a696e14818374726571756573742e6f75743e6d6f64656c2e696e825682816772657175657374818380018207820663626f620001178283636f757400a601505ba912d3696d95a061b788ba2c4cacd70250b312f77e5679f2bf2cf6a90512486e150350e6c20d6146234b74a33da1c709e86efd040105820259018f820f8682656572726f72821382008207f68262696482066c726573705f6669787475726582666f626a656374820668726573706f6e736582666f757470757482118182108382820664726f6c65820669617373697374616e7482820664747970658206676d65737361676582820667636f6e74656e7482118182108382820664746578748206781f48656c6c6f2066726f6d207468652073696d756c61746564206d6f64656c2e828206647479706582066b6f75747075745f746578748282066b616e6e6f746174696f6e73821180826673746174757382138201820669636f6d706c657465648265757361676582138201820f85826c696e7075745f746f6b656e7382140c8274696e7075745f746f6b656e735f64657461696c73821382018210818282066d6361636865645f746f6b656e73820200826d6f75747075745f746f6b656e7382140482756f75747075745f746f6b656e735f64657461696c738213820182108182820670726561736f6e696e675f746f6b656e73820200826c746f74616c5f746f6b656e7382141006828363617070636a6f62820662623183636170706773657373696f6e820663626f6283646578697400a601504bca3916c10fb79f16e79de566b7c1550250b312f77e5679f2bf2cf6a90512486e150350e6c20d6146234b74a33da1c709e86efd0401058202581c82138269436f6d706c65746564820f818266737461747573820218c806828363617070636a6f62820662623183636170706773657373696f6e820663626f6218198283504bca3916c10fb79f16e79de566b7c155766d6f64656c2e657869743e7465726d696e616c2e696e82578281687465726d696e616c818380018207820663626f620083505ba912d3696d95a061b788ba2c4cacd7781a6d6f64656c2e6f75743e6578706c61696e5f75736167652e696e82581c82816d6578706c61696e5f7573616765818380018207820663626f6200
a80702116d6578706c61696e5f75736167651282581c82816d6578706c61696e5f7573616765818380018207820663626f620013676c3a737461727414801780181a505ba912d3696d95a061b788ba2c4cacd71822824e8280818380018207820663626f6200
a8070211687465726d696e616c1282578281687465726d696e616c818380018207820663626f620013676c3a737461727414801780181a504bca3916c10fb79f16e79de566b7c1551822824e8280818380018207820663626f6200
a60702116d6578706c61696e5f75736167651282581c82816d6578706c61696e5f7573616765818380018207820663626f62001364703a696e148183781a6d6f64656c2e6f75743e6578706c61696e5f75736167652e696e82548281656d6f64656c818380018207820663626f6200011780
a6070211687465726d696e616c1282578281687465726d696e616c818380018207820663626f62001364703a696e148183766d6f64656c2e657869743e7465726d696e616c2e696e82548281656d6f64656c818380018207820663626f6200011780
a6070108a401506c793d2fff3f39818152c34ffedee98103506c793d2fff3f39818152c34ffedee98104010582025840820f8382636a6f628206626132826670726f6d7074820677416e6f7468657220696e646570656e64656e74206a6f62826773657373696f6e820665616c69636509636c61620a020b000d81826e2e696e3e726571756573742e696e82581882816772657175657374818380018207820665616c69636500
a807021167726571756573741282581882816772657175657374818380018207820665616c696365001364703a696e1481836e2e696e3e726571756573742e696e82508280818380018207820665616c6963650002178183636f757400a60150d86e9f1831c6494789aa711badd7ddd302506c793d2fff3f39818152c34ffedee98103506c793d2fff3f39818152c34ffedee98104010582025865820f858265696e707574820677416e6f7468657220696e646570656e64656e74206a6f6282716d61785f6f75747075745f746f6b656e738202188082656d6f64656c82066b6770742d362d6173747261826573746f72658201f4826673747265616d8201f406828363617070636a6f62820662613283636170706773657373696f6e820665616c6963651818818201505d480b4d1cb0c47547a7f416398d9e481819818350d86e9f1831c6494789aa711badd7ddd374726571756573742e6f75743e6d6f64656c2e696e82568281656d6f64656c818380018207820665616c69636500
a60703181b50d86e9f1831c6494789aa711badd7ddd3181c656d6f64656c181e5820d58e69e99055a2805c230647ed967fef93b58b8b820b06ee81c958388772c531181f01182174726571756573742e6f75743e6d6f64656c2e696e
a70703181b50d86e9f1831c6494789aa711badd7ddd3181c656d6f64656c181e5820d58e69e99055a2805c230647ed967fef93b58b8b820b06ee81c958388772c531181f02182082018282636f7574820259018f820f8682656572726f72821382008207f68262696482066c726573705f6669787475726582666f626a656374820668726573706f6e736582666f757470757482118182108382820664726f6c65820669617373697374616e7482820664747970658206676d65737361676582820667636f6e74656e7482118182108382820664746578748206781f48656c6c6f2066726f6d207468652073696d756c61746564206d6f64656c2e828206647479706582066b6f75747075745f746578748282066b616e6e6f746174696f6e73821180826673746174757382138201820669636f6d706c657465648265757361676582138201820f85826c696e7075745f746f6b656e7382140c8274696e7075745f746f6b656e735f64657461696c73821382018210818282066d6361636865645f746f6b656e73820200826d6f75747075745f746f6b656e7382140482756f75747075745f746f6b656e735f64657461696c738213820182108182820670726561736f6e696e675f746f6b656e73820200826c746f74616c5f746f6b656e738214108264657869748202581c82138269436f6d706c65746564820f818266737461747573820218c8182174726571756573742e6f75743e6d6f64656c2e696e
a7070211656d6f64656c1282568281656d6f64656c818380018207820665616c696365001364703a696e14818374726571756573742e6f75743e6d6f64656c2e696e82581882816772657175657374818380018207820665616c6963650002178283636f757400a6015093f83c16cbcdd7c379cf6f05bcea521e0250d86e9f1831c6494789aa711badd7ddd303506c793d2fff3f39818152c34ffedee981040105820259018f820f8682656572726f72821382008207f68262696482066c726573705f6669787475726582666f626a656374820668726573706f6e736582666f757470757482118182108382820664726f6c65820669617373697374616e7482820664747970658206676d65737361676582820667636f6e74656e7482118182108382820664746578748206781f48656c6c6f2066726f6d207468652073696d756c61746564206d6f64656c2e828206647479706582066b6f75747075745f746578748282066b616e6e6f746174696f6e73821180826673746174757382138201820669636f6d706c657465648265757361676582138201820f85826c696e7075745f746f6b656e7382140c8274696e7075745f746f6b656e735f64657461696c73821382018210818282066d6361636865645f746f6b656e73820200826d6f75747075745f746f6b656e7382140482756f75747075745f746f6b656e735f64657461696c738213820182108182820670726561736f6e696e675f746f6b656e73820200826c746f74616c5f746f6b656e7382141006828363617070636a6f62820662613283636170706773657373696f6e820665616c69636583646578697400a6015021e649687ec5094e871d1561c4fd85800250d86e9f1831c6494789aa711badd7ddd303506c793d2fff3f39818152c34ffedee9810401058202581c82138269436f6d706c65746564820f818266737461747573820218c806828363617070636a6f62820662613283636170706773657373696f6e820665616c696365181982835021e649687ec5094e871d1561c4fd8580766d6f64656c2e657869743e7465726d696e616c2e696e8258198281687465726d696e616c818380018207820665616c69636500835093f83c16cbcdd7c379cf6f05bcea521e781a6d6f64656c2e6f75743e6578706c61696e5f75736167652e696e82581e82816d6578706c61696e5f7573616765818380018207820665616c69636500
a60702116d6578706c61696e5f75736167651282581e82816d6578706c61696e5f7573616765818380018207820665616c696365001364703a696e148183781a6d6f64656c2e6f75743e6578706c61696e5f75736167652e696e82568281656d6f64656c818380018207820665616c69636500021780
a6070211687465726d696e616c128258198281687465726d696e616c818380018207820665616c696365001364703a696e148183766d6f64656c2e657869743e7465726d696e616c2e696e82568281656d6f64656c818380018207820665616c69636500021780
seal 53fde566fb48ea019d3f0b337349482361780d44c0520e3714578b29dd0d4c72
```

</details>

## Carry forward

Previous: [Countdown](/examples/07-countdown.md). Use an explicit response type when
a partner supplies usage or another business quantity. Keep each original
sample and its provenance, including an honest absence. Compare this short
adapter with the resident [Agent gateway](/examples/06-agent-gateway.md): the same
typed-boundary discipline applies to two different interaction lifetimes.

## Limits

The Lab scripts typed responses. Separate local wire tests, described in
the [projected JSON qualification](https://github.com/rastok-io/rastok/blob/2e5128c76faf35cc879211138f429a4048608c77/docs/architecture/openai-responses-hydration.md),
exercise full JSON deserialization; no paid OpenAI invocation is claimed.
An API can change its payload and fail deserialization at runtime.

No reporting engine, pricing rule or automatic inference retry is supplied.
Missing usage remains unknown. The in-memory journal is not durable recovery.
The boot-dependent profile also refuses `run --record`; use these versioned
Lab traces rather than treating a deployment credential as a replay input.
