SuperPi.AI.Providers.Anthropic (super_pi v0.1.0)

Copy Markdown View Source

Anthropic Messages API (claude-*).

Configure with ANTHROPIC_API_KEY or config :super_pi, anthropic_api_key: "...". Other settings (all optional):

Config keyDefault
:anthropic_base_urlhttps://api.anthropic.com
:anthropic_modelsthe models listed in /v1/models and the CLI
:anthropic_max_tokens8192 (the API requires a limit)
:anthropic_version2023-06-01

What is not done:

  • Extended thinking is not enabled. A thinking block in the history (for example from an earlier turn on another provider) is dropped, because Anthropic needs the signed block back unchanged and thinking is off. Turning thinking on needs the signatures to round-trip, which has not been verified against the live API.
  • --json-schema structured output is ignored.
  • Prompt caching markers are not sent.

The request and the stream parsing are tested against a local server that replays the documented event format. They have not run against the live API (no key was available); see test/super_pi/ai/live_provider_test.exs for the opt-in live test.

Summary

Functions

The request body for a provider payload.

Functions

build_body(payload, model \\ nil)

The request body for a provider payload.