five-on-it / apps/creator/src/claude
apps/creator/src/claude
Anthropic's Messages API (POST /v1/messages) as a Model: the platform's own Claude key (ANTHROPIC_API_KEY, never a creator's), the conversation turned from the chat-completions shape the runner speaks into Claude's (the system prompt apart, the tool calls as tool_use blocks, the tools' answers as tool_result blocks of a user turn), one tool call at a time (disable_parallel_tool_use), and the models after the first as fallbacks (tried when one is busy past its retries or gone). The prefix of every call (the tools and the creator card) and the conversation so far are cached (cache_control), so a turn pays a tenth of the price or less for what it read before.
Anthropic's answer says the tokens a call took, not what it cost: the cost is worked out from the model's list price (CLAUDE_PRICES, USD a million tokens: read, written to the cache, read from it, and answered; Haiku 5.5 dearer for a prompt over 100,000 tokens), or from FOI_CREATOR_PRICE for a model the table does not know. The runner bounds each call with the dearest of them (claudePrice: every token read as a cache write at the long-prompt price), so the job's cap holds whatever the call turns out to be. A busy provider (429, 5xx, 529 overloaded) is tried again a couple of times, and every refusal is no fault of the brief (ModelError.system).