Model Client

loom-sprint-scaffoldsourcetypescript
Path: loom-sprint-scaffold/loom/src/execution/model-client.tsRelative: loom/src/execution/model-client.tsSubproject: loom-sprint-scaffoldCategory: other
Lines: 93Bytes: 2,958Imports: 4Exports: 2

Content Preview

  1. /**
  2. * H3.0 — Fetch-based Anthropic Messages API client.
  3. * workerd-compatible: plain fetch, NO node SDK, no node:* imports.
  4. * Exports a factory that returns a ModelCaller wrapped with withRetry.
  5. */
  6. import { withRetry } from "../lib/retry";
  7. import { createLogger } from "../lib/logger";
  8. import { ModelError } from "../types/errors";
  9. import type {
  10. AnthropicRequest,
  11. AnthropicResponse,
  12. ModelCaller,
  13. } from "../types/execution";
  14. const DEFAULT_MAX_TOKENS = 4096;
  15. const ANTHROPIC_VERSION = "2023