Today's ledger shows where the money goes: #95's failed run was 43 steps, each re-sending the whole conversation (up to 58k tokens) at full input price, $2.80 for nothing. The engine talks to Claude through Anthropic's OpenAI-compatible endpoint, which has no prompt caching (their docs say so outright); the native Messages API does.
anthropic_messages() posts to /v1/messages, speaking the engine's OpenAI shape on both sides: to_messages() turns system/user/assistant/tool messages and the tool list into the native request, with two cache breakpoints (tools + system prompt; the conversation so far), so each step pays for the previous step's context at a tenth of the price. An assistant turn that issued tool calls goes back exactly as the API gave it (thinking blocks included, which the API requires); the tool results of one turn travel in one user message. from_messages() turns the reply back into choices[0].message with tool_calls, and keeps the cache split in usage.
book() prices cache reads at 0.1x and cache writes at 1.25x the input price and writes cached / written on the ledger line; in still counts every prompt token, so old lines and new ones read alike.
TIME_ANTHROPIC_API=compat goes back to the old endpoint (the kill switch if the native path misbehaves live); the doctor lists it.
Tests: the fake Anthropic endpoint in test_time.py now speaks the Messages API and checks the headers and the request shape; the cached-token pricing, the compat switch and the translation (tools, tool calls, merged tool results, verbatim turns, the two breakpoints) are covered. Suite: ALL OK locally; CI runs the same.
DONE: PR open; python3 .github/time/test_time.py passes; CI green; the first worker run after the merge books ledger lines with cached > 0.
Today's ledger shows where the money goes: #95's failed run was 43 steps, each re-sending the whole conversation (up to 58k tokens) at full input price, $2.80 for nothing. The engine talks to Claude through Anthropic's OpenAI-compatible endpoint, which has no prompt caching (their docs say so outright); the native Messages API does.
- `anthropic_messages()` posts to `/v1/messages`, speaking the engine's OpenAI shape on both sides: `to_messages()` turns system/user/assistant/tool messages and the tool list into the native request, with two cache breakpoints (tools + system prompt; the conversation so far), so each step pays for the previous step's context at a tenth of the price. An assistant turn that issued tool calls goes back exactly as the API gave it (thinking blocks included, which the API requires); the tool results of one turn travel in one user message. `from_messages()` turns the reply back into `choices[0].message` with `tool_calls`, and keeps the cache split in `usage`.
- `book()` prices cache reads at 0.1x and cache writes at 1.25x the input price and writes `cached` / `written` on the ledger line; `in` still counts every prompt token, so old lines and new ones read alike.
- `TIME_ANTHROPIC_API=compat` goes back to the old endpoint (the kill switch if the native path misbehaves live); the doctor lists it.
Tests: the fake Anthropic endpoint in `test_time.py` now speaks the Messages API and checks the headers and the request shape; the cached-token pricing, the compat switch and the translation (tools, tool calls, merged tool results, verbatim turns, the two breakpoints) are covered. Suite: ALL OK locally; CI runs the same.
PR: #120
DONE: PR open; `python3 .github/time/test_time.py` passes; CI green; the first worker run after the merge books ledger lines with `cached` > 0.
⏱️ Time: adopted PR #120, built outside the worker. haiku reviewed it on the PR.
⏱️ Time: adopted PR #120, built outside the worker. `haiku` reviewed it on the PR.
<!-- time {"beat":"pr","pr":120,"adopted":true,"launched":false,"review":"venice","seat":"haiku","as":"seat"} -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Today's ledger shows where the money goes: #95's failed run was 43 steps, each re-sending the whole conversation (up to 58k tokens) at full input price, $2.80 for nothing. The engine talks to Claude through Anthropic's OpenAI-compatible endpoint, which has no prompt caching (their docs say so outright); the native Messages API does.
anthropic_messages()posts to/v1/messages, speaking the engine's OpenAI shape on both sides:to_messages()turns system/user/assistant/tool messages and the tool list into the native request, with two cache breakpoints (tools + system prompt; the conversation so far), so each step pays for the previous step's context at a tenth of the price. An assistant turn that issued tool calls goes back exactly as the API gave it (thinking blocks included, which the API requires); the tool results of one turn travel in one user message.from_messages()turns the reply back intochoices[0].messagewithtool_calls, and keeps the cache split inusage.book()prices cache reads at 0.1x and cache writes at 1.25x the input price and writescached/writtenon the ledger line;instill counts every prompt token, so old lines and new ones read alike.TIME_ANTHROPIC_API=compatgoes back to the old endpoint (the kill switch if the native path misbehaves live); the doctor lists it.Tests: the fake Anthropic endpoint in
test_time.pynow speaks the Messages API and checks the headers and the request shape; the cached-token pricing, the compat switch and the translation (tools, tool calls, merged tool results, verbatim turns, the two breakpoints) are covered. Suite: ALL OK locally; CI runs the same.PR: #120
DONE: PR open;
python3 .github/time/test_time.pypasses; CI green; the first worker run after the merge books ledger lines withcached> 0.⏱️ Time: adopted PR #120, built outside the worker.
haikureviewed it on the PR.⏱️ Time: approved, but checks are failing on PR #120. Waiting for a fix.
⏱️ Time: approved and green, merged PR #120. Card done.