# rye:signed:2026-04-14T02:15:38Z:8ad9b043cb64ef02fd28907a502f9dc7f2becf6167bc1f3388eb851eee9fa974:PE_5XkZZ46AtIgW3W4S-8HGyDPlISIn653VQYmykFes_bFksFsZ0Jb8D6GTNMpDV-3Jwp5Ej1OR6GIKNm79ADw:6ea18199041a1ea8
tool_id: anthropic
tool_type: http
version: "1.3.0"
description: "Anthropic Messages API — system default provider for thread execution"
executor_id: rye/core/primitives/execute
category: rye/agent/providers/anthropic

requires:
  - net.call

tier_mapping:
  fast: "claude-haiku-4-5-20251001"
  general: "claude-haiku-4-5-20251001"
  high: "claude-sonnet-4-5-20250929"
  max: "claude-opus-4-6"

# Per-million-token pricing (USD)
pricing:
  claude-3-haiku-20240307:
    input: 0.25
    output: 1.25
    max_output_tokens: 4096
  claude-haiku-4-5-20251001:
    input: 1.00
    output: 5.00
  claude-sonnet-4-5-20250929:
    input: 3.00
    output: 15.00
  claude-opus-4-6:
    input: 5.00
    output: 25.00

env_config:
  env:
    ANTHROPIC_API_KEY: "${ANTHROPIC_API_KEY}"

config:
  method: POST
  url: "https://api.anthropic.com/v1/messages"

  auth:
    type: api_key
    key: "${ANTHROPIC_API_KEY}"
    header: x-api-key

  headers:
    Content-Type: application/json
    anthropic-version: "2023-06-01"

  body:
    model: "{model}"
    max_tokens: "{max_tokens}"
    messages: "{messages}"
    tools: "{tools}"
    stream: "{stream}"

  timeout: 120

  retry:
    max_attempts: 2
    backoff: exponential

parameters:
  - name: model
    type: string
    required: true
    default: "claude-haiku-4-5-20251001"
  - name: max_tokens
    type: integer
    required: false
    default: 4096
  - name: messages
    type: array
    required: true
    description: "Array of {role, content} message objects"
  - name: tools
    type: array
    required: false
    default: []
    description: "Array of tool definitions for function calling"

tool_use:
  mode: native
  tool_definition:
    name: "{name}"
    description: "{description}"
    input_schema: "{schema}"

  response_schema:
    content_mode: blocks
    content_path: "content"
    block_detect:
      text: {field: "type", value: "text"}
      tool_call: {field: "type", value: "tool_use"}
    text_value: "text"
    tool_call_name: "name"
    tool_call_input: "input"
    tool_call_id: "id"
    usage_path: "usage"
    input_tokens: "input_tokens"
    output_tokens: "output_tokens"
    finish_reason_path: "stop_reason"
    finish_reason_tool_use: "tool_use"

  message_schema:
    role_map: {user: "user", assistant: "assistant"}
    content_key: "content"
    content_wrap: "blocks_array"
    tool_result:
      role: "user"
      wrap_mode: "content_blocks"
      error_field: "is_error"
      block_template:
        type: "tool_result"
        tool_use_id: "{tool_call_id}"
        content: "{content}"
    tool_call_block_template:
      type: "tool_use"
      id: "{id}"
      name: "{name}"
      input: "{input}"

  stream_schema:
    stream_mode: "event_typed"
    event_type_field: "type"
    message_start_type: "message_start"
    message_start_usage: "message.usage"
    block_start_type: "content_block_start"
    block_start_path: "content_block"
    block_delta_type: "content_block_delta"
    delta_path: "delta"
    delta_type_field: "type"
    text_delta_type: "text_delta"
    text_delta_field: "text"
    tool_input_delta_type: "input_json_delta"
    tool_input_delta_field: "partial_json"
    message_delta_type: "message_delta"
    finish_reason_path: "delta.stop_reason"
    delta_usage_path: "usage"
