Crate cogito_claude

Crate cogito_claude 

Source
Expand description

An implementation of a client for Anthropic’s Claude API.

This provider implements traits from cogito to provide a uniform way to access Anthropic’s Claude API. This makes it easy to swap out other providers for Anthropic’s Claude in your application, or vice versa.

This library assumes you pass authentication tokens for the Anthropic API using cogito::service::Auth. This means that you are solely responsible for paying the costs of API access; the Cogito developers are not responsible for costs you incur while using this library.

§Cost

There’s no such thing as a free lunch, and there’s no such thing as free Claude access. When you create a Claude API client, you will need to select a ClaudeModel. Models are billed on a per-token basis, where a token is the smallest unit of text that the model reads and processes. There are two types of tokens: input tokens and output tokens.

  • Input tokens are the token used in any requests made to the Claude AI. This is the “prompt” that users of this library send to Claude for summarization.
  • Output tokens are tokens generated in the output that is sent back to a client in response to a request.

Prices are expressed in US dollars per $1 million tokens. As of 25 November 2025, the prices for each model are as follows.

For the latest pricing, see the pricing documentation in the Claude platform documentation.

ModelDesignationInputOutput
Sonnet 4.5claude-sonnet-4-5$3$15
Haiku 4.5claude-haiku-4-5$1$5
Opus 4.5claude-opus-4-5$5$25
Opus 4.1claude-opus-4-1$15$75

Modules§

client
Anthropic Claude API client.
prelude
Convenience module for splat imports.
service
Services for communicating with the Claude API over HTTP.

Enums§

ClaudeModel
Available Claude AI models.