Anthropic: Claude 3 Haiku

anthropic/claude-3-haiku

Claude 3 Haiku is Anthropic's fastest and most compact model for near-instant responsiveness. Quick and accurate targeted performance.

See the launch announcement and benchmark results [here](https:/...

visiontools
MODALITIES
INPUT PRICE
$0.25per 1M
OUTPUT PRICE
$1.25per 1M
CONTEXT
200K
RELEASED
Mar 13, 2024
ProviderCacheUptimeChat
$0.25$1.25
Cache read$0.03

Capabilities

Input modalities
imagetext
Output modalities
text
Features
max_tokensstoptemperaturetool_choicetoolstop_ktop_p
1

Get your API key

Create an API key from the Keys page, then set it as an environment variable:

export ONLIST_API_KEY=sk-...
2

Make your first request

Endpoints

POSThttps://onlist.io/v1/chat/completions

OpenAI Chat Completions format

Request Headers
Authorization:Bearer $ONLIST_API_KEY
Content-Type:application/json
Model:anthropic/claude-3-haiku
POSThttps://onlist.io/v1/responses

OpenAI Responses format

Request Headers
Authorization:Bearer $ONLIST_API_KEY
Content-Type:application/json
Model:anthropic/claude-3-haiku
POSThttps://onlist.io/v1/messages

Anthropic Messages format

Request Headers
Authorization:Bearer $ONLIST_API_KEY
Content-Type:application/json
Model:anthropic/claude-3-haiku

Code samples

curl https://onlist.io/v1/chat/completions \
  -H "Authorization: Bearer $ONLIST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "model": "anthropic/claude-3-haiku",
       "messages": [
         {
           "role": "user",
           "content": "Explain quantum entanglement in one paragraph."
         }
       ]
     }'

Replace $ONLIST_API_KEY with the API key from your Keys page.

Authentication

All requests must include an Authorization: Bearer <TOKEN> header. Generate keys from the Keys page; keys can be scoped to specific models, groups, IP ranges, and rate limits.

3

Enable streaming

Add "stream": true to receive partial responses as server-sent events in real time.

Streaming example

curl https://onlist.io/v1/chat/completions \
  -H "Authorization: Bearer $ONLIST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "model": "anthropic/claude-3-haiku",
       "messages": [
         {
           "role": "user",
           "content": "Write a haiku about recursion."
         }
       ],
       "stream": true
     }'

Supported parameters

NameTypeDescription
max_tokensintegerMaximum number of tokens to generate in the completion.
stopstring | arrayUp to 4 sequences where the API will stop generating tokens.
temperaturenumberSampling temperature between 0 and 2. Higher values make output more random.
tool_choicestring | objectControls which tool is called. "auto", "none", "required", or a specific function.
toolsarrayA list of tools the model may call. Currently supports functions.
top_kintegerLimits token selection to the k most likely candidates at each step.
top_pnumberNucleus sampling. The model considers tokens with top_p probability mass.

These are the request parameters this model accepts. Parameter semantics follow the OpenAI Chat Completions specification.