# Anthropic

## Overview

**Anthropic** is an AI research and product company founded by former OpenAI researchers. The company is best known for its strong emphasis on AI safety, interpretability, and long-term alignment. Anthropic describes its mission as building “reliable, interpretable, and steerable” AI systems that can be safely deployed at scale.

Its product lineup spans lightweight **Haiku** models for fast inference, **Sonnet** models aimed at general-purpose production workloads, and **Opus** models designed for advanced reasoning, coding, and research tasks. Beyond chat assistants, Anthropic is actively expanding into agentic tooling with products such as [Claude Code](/integrations/claude-code.md) and enterprise integrations focused on automation, software engineering, and organizational workflows.

***

The chat models from this provider have some unique characteristics. Models from Anthropic can be accessed not only via the standard `/v1/chat/completions` endpoint but also through dedicated endpoints — `/messages` and `/v1/batches`.\
The sections below describe their API schemas, usage specifics, and example requests.

Supported capabilities:

* **Text completions:** Build advanced chat bots or text processors.
* **Function Calling:** Utilize tools for specific tasks and API calling.
* **Stream mode:** Get the text chat model responses as they are generated, rather than waiting for the entire response to be completed.
* **Batch Processing:** Send multiple independent requests in a single API call.
* **Vision Tasks:** Process and analyze images.

## Text Completions

Ask something and get an answer in a chat-like conversation format.

## POST /v1/messages

>

```json
{"openapi":"3.0.0","info":{"title":"AIML API","version":"1.0.0"},"servers":[{"url":"https://api.aimlapi.com"}],"paths":{"/v1/messages":{"post":{"operationId":"_v1_messages","requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"model":{"type":"string","enum":["claude-opus-4-1-20250805","anthropic/claude-opus-4-1-20250805","claude-opus-4-20250514","anthropic/claude-opus-4-20250514","claude-sonnet-4-20250514","anthropic/claude-sonnet-4-20250514","claude-sonnet-4-5-20250929","anthropic/claude-sonnet-4-5-20250929","claude-haiku-4-5-20251001","anthropic/claude-haiku-4-5-20251001","claude-opus-4-5-20251101","anthropic/claude-opus-4-5-20251101","claude-opus-4-6","anthropic/claude-opus-4-6","claude-sonnet-4-6","anthropic/claude-sonnet-4-6","claude-sonnet-4-latest","anthropic/claude-sonnet-4","claude-opus-4-latest","anthropic/claude-opus-4","claude-opus-4-1-latest","claude-opus-4-1","anthropic/claude-opus-4.1","anthropic/claude-opus-4.1-20250805","anthropic/claude-sonnet-4.5","claude-sonnet-4-5","anthropic/claude-haiku-4.5","claude-haiku-4-5","anthropic/claude-opus-4-5","claude-opus-4-5","anthropic/claude-opus-4.5","anthropic/claude-sonnet-4.6","anthropic/claude-sonnet-4-6-20260218"]},"messages":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","enum":["image"]},"source":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["base64"],"description":"The type of the image."},"media_type":{"type":"string","enum":["image/jpeg","image/png","image/gif","image/webp"],"description":"The media type of the image."},"data":{"type":"string","description":"The base64 encoded image data."}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["url"]},"url":{"type":"string","format":"uri"}},"required":["type","url"]}]}},"required":["type","source"]},{"type":"object","properties":{"type":{"type":"string","enum":["thinking"]},"thinking":{"type":"string"},"signature":{"type":"string"}},"required":["type","thinking","signature"]},{"type":"object","properties":{"type":{"type":"string","enum":["tool_result"]},"tool_use_id":{"type":"string"},"is_error":{"type":"boolean"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","enum":["image"]},"source":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["base64"],"description":"The type of the image."},"media_type":{"type":"string","enum":["image/jpeg","image/png","image/gif","image/webp"],"description":"The media type of the image."},"data":{"type":"string","description":"The base64 encoded image data."}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["url"]},"url":{"type":"string","format":"uri"}},"required":["type","url"]}]}},"required":["type","source"]},{"type":"object","properties":{"type":{"type":"string","enum":["search_result"]},"source":{"type":"string"},"title":{"type":"string"},"content":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]}},"required":["type","source","title","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["document"]},"source":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["base64"]},"media_type":{"type":"string","enum":["application/pdf","text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"media_type":{"type":"string","enum":["text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["url"]},"url":{"type":"string","format":"uri"}},"required":["type","url"]},{"type":"object","properties":{"type":{"type":"string","enum":["content"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"nullable":true}}]}},"required":["type","content"]}]},"title":{"type":"string"},"context":{"type":"string"}},"required":["type","source"]},{"type":"object","properties":{"type":{"type":"string","enum":["tool_reference"]},"tool_name":{"type":"string"}},"required":["type","tool_name"]}]}}]}},"required":["type","tool_use_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["tool_use"]},"id":{"type":"string"},"name":{"type":"string"},"input":{"type":"object","additionalProperties":{"nullable":true}},"caller":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20250825"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20260120"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]}]}},"required":["type","id","name","input"]},{"type":"object","properties":{"type":{"type":"string","enum":["server_tool_use"]},"id":{"type":"string"},"name":{"type":"string","enum":["web_search","web_fetch","code_execution","bash_code_execution","text_editor_code_execution","tool_search_tool_regex","tool_search_tool_bm25"]},"input":{"type":"object","additionalProperties":{"nullable":true}},"caller":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20250825"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20260120"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]}]}},"required":["type","id","name","input"]},{"type":"object","properties":{"type":{"type":"string","enum":["search_result"]},"source":{"type":"string"},"title":{"type":"string"},"content":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]}},"required":["type","source","title","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["web_search_tool_result"]},"tool_use_id":{"type":"string"},"content":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["web_search_result"]},"title":{"type":"string"},"url":{"type":"string"},"page_age":{"type":"string"},"encrypted_content":{"type":"string"}},"required":["type","title","url","encrypted_content"]}},{"type":"object","properties":{"type":{"type":"string","enum":["web_search_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","unavailable","max_uses_exceeded","too_many_requests","query_too_long","request_too_large"]}},"required":["type","error_code"]}]},"caller":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20250825"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20260120"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]}]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["web_fetch_tool_result"]},"tool_use_id":{"type":"string"},"content":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["web_fetch_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","url_too_long","url_not_allowed","url_not_accessible","unsupported_content_type","too_many_requests","max_uses_exceeded","unavailable"]}},"required":["type","error_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["web_fetch_result"]},"url":{"type":"string"},"retrieved_at":{"type":"string"},"content":{"type":"object","properties":{"type":{"type":"string","enum":["document"]},"source":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["base64"]},"media_type":{"type":"string","enum":["application/pdf","text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"media_type":{"type":"string","enum":["text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["url"]},"url":{"type":"string","format":"uri"}},"required":["type","url"]},{"type":"object","properties":{"type":{"type":"string","enum":["content"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"nullable":true}}]}},"required":["type","content"]}]},"title":{"type":"string"},"context":{"type":"string"}},"required":["type","source"]}},"required":["type","url","content"]}]},"caller":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20250825"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20260120"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]}]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_tool_result"]},"tool_use_id":{"type":"string"},"content":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","unavailable","too_many_requests","execution_time_exceeded"]}},"required":["type","error_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_result"]},"stdout":{"type":"string"},"stderr":{"type":"string"},"return_code":{"type":"number"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_output"]},"file_id":{"type":"string"}},"required":["type","file_id"]}}},"required":["type","stdout","stderr","return_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["encrypted_code_execution_result"]},"encrypted_stdout":{"type":"string"},"stderr":{"type":"string"},"return_code":{"type":"number"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_output"]},"file_id":{"type":"string"}},"required":["type","file_id"]}}},"required":["type","encrypted_stdout","stderr","return_code"]}]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["bash_code_execution_tool_result"]},"tool_use_id":{"type":"string"},"content":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["bash_code_execution_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","unavailable","too_many_requests","execution_time_exceeded","output_file_too_large"]}},"required":["type","error_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["bash_code_execution_result"]},"stdout":{"type":"string"},"stderr":{"type":"string"},"return_code":{"type":"number"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["bash_code_execution_output"]},"file_id":{"type":"string"}},"required":["type","file_id"]}}},"required":["type","stdout","stderr","return_code"]}]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["text_editor_code_execution_tool_result"]},"tool_use_id":{"type":"string"},"content":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text_editor_code_execution_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","unavailable","too_many_requests","execution_time_exceeded","file_not_found"]},"error_message":{"type":"string"}},"required":["type","error_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["text_editor_code_execution_view_result"]},"content":{"type":"string"},"file_type":{"type":"string","enum":["text","image","pdf"]},"start_line":{"type":"number"},"num_lines":{"type":"number"},"total_lines":{"type":"number"}},"required":["type","content","file_type"]},{"type":"object","properties":{"type":{"type":"string","enum":["text_editor_code_execution_create_result"]},"is_file_update":{"type":"boolean"}},"required":["type","is_file_update"]},{"type":"object","properties":{"type":{"type":"string","enum":["text_editor_code_execution_str_replace_result"]},"old_start":{"type":"number"},"old_lines":{"type":"number"},"new_start":{"type":"number"},"new_lines":{"type":"number"},"lines":{"type":"array","items":{"type":"string"}}},"required":["type"]}]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["tool_search_tool_result"]},"tool_use_id":{"type":"string"},"content":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["tool_search_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","unavailable","too_many_requests","execution_time_exceeded"]}},"required":["type","error_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["tool_search_tool_search_result"]},"tool_references":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["tool_reference"]},"tool_name":{"type":"string"}},"required":["type","tool_name"]}}},"required":["type","tool_references"]}]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["redacted_thinking"]},"data":{"type":"string"}},"required":["type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["document"]},"source":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["base64"]},"media_type":{"type":"string","enum":["application/pdf","text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"media_type":{"type":"string","enum":["text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["url"]},"url":{"type":"string","format":"uri"}},"required":["type","url"]},{"type":"object","properties":{"type":{"type":"string","enum":["content"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"nullable":true}}]}},"required":["type","content"]}]},"title":{"type":"string"},"context":{"type":"string"}},"required":["type","source"]}]}}]}},"required":["role","content"]}},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"role":{"type":"string","enum":["system"],"description":"The role of the author of the message — in this case, the system."},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]}}],"description":"The contents of the system message."},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["role","content"]},{"type":"object","properties":{"role":{"type":"string","enum":["user"],"description":"The role of the author of the message — in this case, the user"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["image_url"]},"image_url":{"type":"object","properties":{"url":{"anyOf":[{"type":"string","format":"uri"},{"type":"string"}],"description":"Either a URL of the image or the base64 encoded image data. "},"detail":{"type":"string","enum":["low","high","auto"],"description":"Specifies the detail level of the image. Currently supports JPG/JPEG, PNG, GIF, and WEBP formats."}},"required":["url"]}},"required":["type","image_url"]},{"type":"object","properties":{"type":{"type":"string","enum":["image"]},"source":{"type":"object","properties":{"type":{"type":"string","enum":["base64"]},"media_type":{"type":"string","enum":["image/jpeg","image/png","image/gif","image/webp"]},"data":{"type":"string"}},"required":["type","media_type","data"]}},"required":["type","source"]},{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","enum":["input_audio"],"description":"The type of the content part."},"input_audio":{"type":"object","properties":{"data":{"anyOf":[{"type":"string","format":"uri"},{"type":"string"},{"type":"string"}],"description":"Either a URL of the audio or the base64 encoded audio data."},"format":{"type":"string","enum":["wav","mp3","audio/x-aac","audio/flac","audio/mp3","audio/m4a","audio/mpeg","audio/mpga","audio/mp4","audio/ogg","audio/pcm","audio/webm"],"description":"The format of the encoded audio data. Currently supports \"wav\" and \"mp3\"."}},"required":["data","format"]}},"required":["type","input_audio"]},{"type":"object","properties":{"type":{"type":"string","enum":["file"],"description":"The type of the content part."},"file":{"type":"object","properties":{"file_data":{"type":"string","description":"The file data, encoded in base64 and passed to the model as a string. Only PDF format is supported.\n        - Maximum size per file: Up to 512 MB and up to 2 million tokens.\n        - Maximum number of files: Up to 20 files can be attached to a single GPT application or Assistant. This limit applies throughout the application's lifetime.\n        - Maximum total file storage per user: 10 GB."},"filename":{"type":"string","description":"The file name specified by the user. This name can be used to reference the file when interacting with the model, especially if multiple files are uploaded."}}}},"required":["type","file"]},{"type":"object","properties":{"type":{"type":"string","enum":["video_url"]},"video_url":{"type":"object","properties":{"url":{"anyOf":[{"type":"string","format":"uri"},{"type":"string"}],"description":"Base64-encoded local video file."}},"required":["url"]}},"required":["type","video_url"]}]}}],"description":"The contents of the user message."},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["role","content"]},{"type":"object","properties":{"role":{"type":"string","enum":["tool"],"description":"The role of the author of the message — in this case, the tool."},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]}}],"description":"The contents of the tool message."},"tool_call_id":{"type":"string","description":"Tool call that this message is responding to."},"name":{"type":"string","nullable":true,"description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["role","content","tool_call_id"]},{"type":"object","properties":{"role":{"type":"string","enum":["function"]},"content":{"type":"string"},"name":{"type":"string"}},"required":["role","content","name"]},{"type":"object","properties":{"role":{"type":"string","enum":["assistant"],"description":"The role of the author of the message — in this case, the Assistant."},"content":{"anyOf":[{"type":"string","description":"The contents of the Assistant message."},{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]},{"type":"object","properties":{"refusal":{"type":"string","description":"The refusal message generated by the model."},"type":{"type":"string","enum":["refusal"],"description":"The type of the content part."}},"required":["refusal","type"]}]},"description":"An array of content parts with a defined type. Can be one or more of type text, or exactly one of type refusal."},{"nullable":true}],"description":"The contents of the Assistant message. Required unless tool_calls or function_call is specified."},"tool_calls":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","description":"The ID of the tool call."},"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only function is supported."},"function":{"type":"object","properties":{"name":{"type":"string","description":"The name of the function to call."},"arguments":{"type":"string","description":"The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."}},"required":["name","arguments"],"description":"The function that the model called."}},"required":["id","type","function"]},{"type":"object","properties":{"id":{"type":"string","description":"The ID of the tool call."},"type":{"type":"string","enum":["custom"],"description":"The type of the tool. Currently, only function is supported."},"custom":{"type":"object","properties":{"name":{"type":"string","description":"The name of the custom tool to call."},"input":{"type":"string","description":"The input for the custom tool call generated by the model."}},"required":["name","input"],"description":"The custom tool that the model called."}},"required":["id","type","custom"]}]},"description":"The tool calls generated by the model, such as function calls."},"refusal":{"type":"string","nullable":true,"description":"The refusal message by the Assistant."},"audio":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"Unique identifier for a previous audio response from the model."}},"required":["id"],"description":"Data about a previous audio response from the model."},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["role"]},{"type":"object","properties":{"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]}}],"description":"The contents of the developer message."},"role":{"type":"string","enum":["developer"],"description":"The role of the author of the message — in this case, the developer."},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["content","role"]}]}}],"description":"A list of messages comprising the conversation so far. Depending on the model you use, different message types (modalities) are supported, like text, documents (txt, pdf), images, and audio."},"metadata":{"type":"object","additionalProperties":{"type":"string"},"description":"An object describing metadata about the request"},"stop_sequences":{"type":"array","items":{"type":"string"},"description":"Custom text sequences that will cause the model to stop generating."},"stream":{"type":"boolean","default":false,"description":"If set to True, the model response data will be streamed to the client as it is generated using server-sent events."},"system":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"default":"text"},"text":{"type":"string"},"citations":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["char_location"]},"cited_text":{"type":"string"},"document_index":{"type":"number"},"document_title":{"type":"string"},"end_char_index":{"type":"number"},"start_char_index":{"type":"number"}},"required":["type","cited_text","document_index","document_title","end_char_index","start_char_index"]},{"type":"object","properties":{"type":{"type":"string","enum":["page_location"]},"cited_text":{"type":"string"},"document_index":{"type":"number"},"document_title":{"type":"string"},"end_page_number":{"type":"number"},"start_page_number":{"type":"number"}},"required":["type","cited_text","document_index","document_title","end_page_number","start_page_number"]},{"type":"object","properties":{"type":{"type":"string","enum":["content_block_location"]},"cited_text":{"type":"string"},"document_index":{"type":"number"},"document_title":{"type":"string"},"end_block_index":{"type":"number"},"start_block_index":{"type":"number"}},"required":["type","cited_text","document_index","document_title","end_block_index","start_block_index"]},{"type":"object","properties":{"type":{"type":"string","enum":["web_search_result_location"]},"cited_text":{"type":"string"},"encrypted_index":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"}},"required":["type","cited_text","encrypted_index","title","url"]},{"type":"object","properties":{"type":{"type":"string","enum":["search_result_location"]},"cited_text":{"type":"string"},"end_block_index":{"type":"number"},"search_result_index":{"type":"number"},"source":{"type":"string"},"start_block_index":{"type":"number"},"title":{"type":"string"}},"required":["type","cited_text","end_block_index","search_result_index","source","start_block_index","title"]}]}}},"required":["text"]}}],"description":"A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role."},"tool_choice":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["auto"]},"disable_parallel_tool_use":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["any"]},"disable_parallel_tool_use":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string","enum":["tool"]},"disable_parallel_tool_use":{"type":"boolean"}},"required":["name","type"]},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"]},{"type":"string","enum":["none","auto","required"],"description":"none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools."},{"type":"object","properties":{"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only function is supported."},"function":{"type":"object","properties":{"name":{"type":"string","description":"The name of the function to call."}},"required":["name"]}},"required":["type","function"],"description":"Specifies a tool the model should use. Use to force the model to call a specific function."},{"type":"object","properties":{"type":{"type":"string","enum":["allowed_tools"],"description":"The type of the tool. Currently, only function is supported."},"allowed_tools":{"type":"object","properties":{"mode":{"type":"string","enum":["auto","required"],"description":"Constrains the tools available to the model to a pre-defined set.\n- auto allows the model to pick from among the allowed tools and generate a message.\n- required requires the model to call one or more of the allowed tools."},"tools":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}},"description":"A list of tool definitions that the model should be allowed to call."}},"required":["mode","tools"]}},"required":["type","allowed_tools"],"description":"Constrains the tools available to the model to a pre-defined set."},{"type":"object","properties":{"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only function is supported."},"function":{"type":"string","enum":["name"],"description":"The name of the function to call."}},"required":["type","function"],"description":"Specifies a tool the model should use. Use to force the model to call a specific function."},{"type":"object","properties":{"type":{"type":"string","enum":["custom"],"description":"The type of the tool. Currently, only function is supported."},"custom":{"type":"string","enum":["name"],"description":"The name of the custom tool to call."}},"required":["type","custom"],"description":"Specifies a tool the model should use. Use to force the model to call a specific custom tool."}],"description":"Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. Specifying a particular tool via {\"type\": \"function\", \"function\": {\"name\": \"my_function\"}} forces the model to call that tool.\n  none is the default when no tools are present. auto is the default if tools are present."},"tools":{"anyOf":[{"type":"array","items":{"oneOf":[{"type":"object","properties":{"name":{"type":"string","description":"Name of the tool."},"description":{"type":"string","description":"Description of what this tool does.\n  Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema."},"input_schema":{"type":"object","properties":{"type":{"type":"string","enum":["object"]},"properties":{"nullable":true},"required":{"type":"array","items":{"type":"string"}}},"required":["type"],"additionalProperties":{"nullable":true},"description":"JSON schema for this tool's input.\n  This defines the shape of the input that your tool accepts and that the model will produce."},"type":{"type":"string","enum":["custom"]},"defer_loading":{"type":"boolean"},"eager_input_streaming":{"type":"boolean"},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["name","input_schema"]},{"type":"object","properties":{"name":{"type":"string","enum":["bash"],"default":"bash"},"type":{"type":"string","enum":["bash_20250124"]},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["code_execution"],"default":"code_execution"},"type":{"type":"string","enum":["code_execution_20250522"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["code_execution"],"default":"code_execution"},"type":{"type":"string","enum":["code_execution_20250825"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["code_execution"],"default":"code_execution"},"type":{"type":"string","enum":["code_execution_20260120"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["memory"],"default":"memory"},"type":{"type":"string","enum":["memory_20250818"]},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["str_replace_editor"],"default":"str_replace_editor"},"type":{"type":"string","enum":["text_editor_20250124"]},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["str_replace_based_edit_tool"],"default":"str_replace_based_edit_tool"},"type":{"type":"string","enum":["text_editor_20250429"]},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["str_replace_based_edit_tool"],"default":"str_replace_based_edit_tool"},"type":{"type":"string","enum":["text_editor_20250728"]},"max_characters":{"type":"number"},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["web_search"],"default":"web_search"},"type":{"type":"string","enum":["web_search_20250305"]},"allowed_domains":{"type":"array","items":{"type":"string"}},"blocked_domains":{"type":"array","items":{"type":"string"}},"max_uses":{"type":"number"},"user_location":{"type":"object","properties":{"type":{"type":"string","enum":["approximate"]},"city":{"type":"string"},"country":{"type":"string"},"region":{"type":"string"},"timezone":{"type":"string"}},"required":["type"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["web_search"],"default":"web_search"},"type":{"type":"string","enum":["web_search_20260209"]},"allowed_domains":{"type":"array","items":{"type":"string"}},"blocked_domains":{"type":"array","items":{"type":"string"}},"max_uses":{"type":"number"},"user_location":{"type":"object","properties":{"type":{"type":"string","enum":["approximate"]},"city":{"type":"string"},"country":{"type":"string"},"region":{"type":"string"},"timezone":{"type":"string"}},"required":["type"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["web_fetch"],"default":"web_fetch"},"type":{"type":"string","enum":["web_fetch_20250910"]},"allowed_domains":{"type":"array","items":{"type":"string"}},"blocked_domains":{"type":"array","items":{"type":"string"}},"citations":{"type":"object","properties":{"enabled":{"type":"boolean"}}},"max_content_tokens":{"type":"number"},"max_uses":{"type":"number"},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["web_fetch"],"default":"web_fetch"},"type":{"type":"string","enum":["web_fetch_20260209"]},"allowed_domains":{"type":"array","items":{"type":"string"}},"blocked_domains":{"type":"array","items":{"type":"string"}},"citations":{"type":"object","properties":{"enabled":{"type":"boolean"}}},"max_content_tokens":{"type":"number"},"max_uses":{"type":"number"},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["web_fetch"],"default":"web_fetch"},"type":{"type":"string","enum":["web_fetch_20260309"]},"allowed_domains":{"type":"array","items":{"type":"string"}},"blocked_domains":{"type":"array","items":{"type":"string"}},"citations":{"type":"object","properties":{"enabled":{"type":"boolean"}}},"max_content_tokens":{"type":"number"},"max_uses":{"type":"number"},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["tool_search_tool_bm25"],"default":"tool_search_tool_bm25"},"type":{"type":"string","enum":["tool_search_tool_bm25_20251119","tool_search_tool_bm25"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["tool_search_tool_regex"],"default":"tool_search_tool_regex"},"type":{"type":"string","enum":["tool_search_tool_regex_20251119","tool_search_tool_regex"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]}]}},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only function is supported."},"function":{"type":"object","properties":{"description":{"type":"string","description":"A description of what the function does, used by the model to choose when and how to call the function."},"name":{"type":"string","description":"The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."},"parameters":{"type":"object","additionalProperties":{"nullable":true,"description":"The parameters the functions accepts, described as a JSON Schema object."}},"strict":{"type":"boolean","nullable":true,"description":"Whether to enable strict schema adherence when generating the function call. If set to True, the model will follow the exact schema defined in the parameters field. Only a subset of JSON Schema is supported when strict is True."}},"required":["name"],"additionalProperties":false}},"required":["type","function"]},{"type":"object","properties":{"type":{"type":"string","enum":["custom"],"description":"The type of the tool. Currently, only function is supported."},"custom":{"type":"object","properties":{"name":{"type":"string","description":"The name of the custom tool, used to identify it in tool calls."},"description":{"type":"string","description":"Optional description of the custom tool, used to provide more context."},"format":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["grammar"]},"grammar":{"type":"object","properties":{"definition":{"type":"string","description":"The grammar definition."},"syntax":{"type":"string","enum":["lark","regex"],"description":"The syntax of the grammar definition."}},"required":["definition","syntax"]}},"required":["type","grammar"]}],"description":"The input format for the custom tool. Default is unconstrained text."}},"required":["name","format"]}},"required":["type","custom"]}]}}],"description":"Definitions of tools that the model may use.\n  If you include tools in your API request, the model may return tool_use content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using tool_result content blocks.\n  Each tool definition includes:\n      name: Name of the tool.\n      description: Optional, but strongly-recommended description of the tool.\n      input_schema: JSON schema for the tool input shape that the model will produce in tool_use output content blocks."},"thinking":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["enabled"]},"budget_tokens":{"type":"integer","minimum":1024,"description":"Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. Must be ≥1024 and less than max_tokens."},"display":{"type":"string","enum":["summarized","omitted"],"default":"summarized"}},"required":["type","budget_tokens"]},{"type":"object","properties":{"type":{"type":"string","enum":["disabled"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["adaptive"]},"display":{"type":"string","enum":["summarized","omitted"],"default":"summarized"}},"required":["type"]}],"description":"Configuration for enabling Claude's extended thinking. When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your max_tokens limit."},"max_tokens":{"type":"number","default":64000,"description":"The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API."},"temperature":{"type":"number","minimum":0,"maximum":1,"description":"Amount of randomness injected into the response. Defaults to 1.0. Ranges from 0.0 to 1.0. Use temperature closer to 0.0 for analytical / multiple choice, and closer to 1.0 for creative and generative tasks. Note that even with temperature of 0.0, the results will not be fully deterministic."},"top_p":{"type":"number","minimum":0,"maximum":1,"description":"An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.\n  We generally recommend altering this or temperature but not both."},"top_k":{"type":"number","minimum":0,"description":"Only sample from the top K options for each subsequent token. Used to remove \"long tail\" low probability responses. Recommended for advanced use cases only. You usually only need to use temperature."}},"required":["model","messages"]},{"type":"object","properties":{"model":{"type":"string","enum":["claude-opus-4-7","anthropic/claude-opus-4-7","anthropic/claude-opus-4.7"]},"messages":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","enum":["image"]},"source":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["base64"],"description":"The type of the image."},"media_type":{"type":"string","enum":["image/jpeg","image/png","image/gif","image/webp"],"description":"The media type of the image."},"data":{"type":"string","description":"The base64 encoded image data."}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["url"]},"url":{"type":"string","format":"uri"}},"required":["type","url"]}]}},"required":["type","source"]},{"type":"object","properties":{"type":{"type":"string","enum":["thinking"]},"thinking":{"type":"string"},"signature":{"type":"string"}},"required":["type","thinking","signature"]},{"type":"object","properties":{"type":{"type":"string","enum":["tool_result"]},"tool_use_id":{"type":"string"},"is_error":{"type":"boolean"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","enum":["image"]},"source":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["base64"],"description":"The type of the image."},"media_type":{"type":"string","enum":["image/jpeg","image/png","image/gif","image/webp"],"description":"The media type of the image."},"data":{"type":"string","description":"The base64 encoded image data."}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["url"]},"url":{"type":"string","format":"uri"}},"required":["type","url"]}]}},"required":["type","source"]},{"type":"object","properties":{"type":{"type":"string","enum":["search_result"]},"source":{"type":"string"},"title":{"type":"string"},"content":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]}},"required":["type","source","title","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["document"]},"source":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["base64"]},"media_type":{"type":"string","enum":["application/pdf","text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"media_type":{"type":"string","enum":["text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["url"]},"url":{"type":"string","format":"uri"}},"required":["type","url"]},{"type":"object","properties":{"type":{"type":"string","enum":["content"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"nullable":true}}]}},"required":["type","content"]}]},"title":{"type":"string"},"context":{"type":"string"}},"required":["type","source"]},{"type":"object","properties":{"type":{"type":"string","enum":["tool_reference"]},"tool_name":{"type":"string"}},"required":["type","tool_name"]}]}}]}},"required":["type","tool_use_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["tool_use"]},"id":{"type":"string"},"name":{"type":"string"},"input":{"type":"object","additionalProperties":{"nullable":true}},"caller":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20250825"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20260120"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]}]}},"required":["type","id","name","input"]},{"type":"object","properties":{"type":{"type":"string","enum":["server_tool_use"]},"id":{"type":"string"},"name":{"type":"string","enum":["web_search","web_fetch","code_execution","bash_code_execution","text_editor_code_execution","tool_search_tool_regex","tool_search_tool_bm25"]},"input":{"type":"object","additionalProperties":{"nullable":true}},"caller":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20250825"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20260120"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]}]}},"required":["type","id","name","input"]},{"type":"object","properties":{"type":{"type":"string","enum":["search_result"]},"source":{"type":"string"},"title":{"type":"string"},"content":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]}},"required":["type","source","title","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["web_search_tool_result"]},"tool_use_id":{"type":"string"},"content":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["web_search_result"]},"title":{"type":"string"},"url":{"type":"string"},"page_age":{"type":"string"},"encrypted_content":{"type":"string"}},"required":["type","title","url","encrypted_content"]}},{"type":"object","properties":{"type":{"type":"string","enum":["web_search_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","unavailable","max_uses_exceeded","too_many_requests","query_too_long","request_too_large"]}},"required":["type","error_code"]}]},"caller":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20250825"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20260120"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]}]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["web_fetch_tool_result"]},"tool_use_id":{"type":"string"},"content":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["web_fetch_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","url_too_long","url_not_allowed","url_not_accessible","unsupported_content_type","too_many_requests","max_uses_exceeded","unavailable"]}},"required":["type","error_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["web_fetch_result"]},"url":{"type":"string"},"retrieved_at":{"type":"string"},"content":{"type":"object","properties":{"type":{"type":"string","enum":["document"]},"source":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["base64"]},"media_type":{"type":"string","enum":["application/pdf","text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"media_type":{"type":"string","enum":["text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["url"]},"url":{"type":"string","format":"uri"}},"required":["type","url"]},{"type":"object","properties":{"type":{"type":"string","enum":["content"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"nullable":true}}]}},"required":["type","content"]}]},"title":{"type":"string"},"context":{"type":"string"}},"required":["type","source"]}},"required":["type","url","content"]}]},"caller":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20250825"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_20260120"]},"tool_id":{"type":"string"}},"required":["type","tool_id"]}]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_tool_result"]},"tool_use_id":{"type":"string"},"content":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","unavailable","too_many_requests","execution_time_exceeded"]}},"required":["type","error_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_result"]},"stdout":{"type":"string"},"stderr":{"type":"string"},"return_code":{"type":"number"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_output"]},"file_id":{"type":"string"}},"required":["type","file_id"]}}},"required":["type","stdout","stderr","return_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["encrypted_code_execution_result"]},"encrypted_stdout":{"type":"string"},"stderr":{"type":"string"},"return_code":{"type":"number"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["code_execution_output"]},"file_id":{"type":"string"}},"required":["type","file_id"]}}},"required":["type","encrypted_stdout","stderr","return_code"]}]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["bash_code_execution_tool_result"]},"tool_use_id":{"type":"string"},"content":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["bash_code_execution_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","unavailable","too_many_requests","execution_time_exceeded","output_file_too_large"]}},"required":["type","error_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["bash_code_execution_result"]},"stdout":{"type":"string"},"stderr":{"type":"string"},"return_code":{"type":"number"},"content":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["bash_code_execution_output"]},"file_id":{"type":"string"}},"required":["type","file_id"]}}},"required":["type","stdout","stderr","return_code"]}]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["text_editor_code_execution_tool_result"]},"tool_use_id":{"type":"string"},"content":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text_editor_code_execution_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","unavailable","too_many_requests","execution_time_exceeded","file_not_found"]},"error_message":{"type":"string"}},"required":["type","error_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["text_editor_code_execution_view_result"]},"content":{"type":"string"},"file_type":{"type":"string","enum":["text","image","pdf"]},"start_line":{"type":"number"},"num_lines":{"type":"number"},"total_lines":{"type":"number"}},"required":["type","content","file_type"]},{"type":"object","properties":{"type":{"type":"string","enum":["text_editor_code_execution_create_result"]},"is_file_update":{"type":"boolean"}},"required":["type","is_file_update"]},{"type":"object","properties":{"type":{"type":"string","enum":["text_editor_code_execution_str_replace_result"]},"old_start":{"type":"number"},"old_lines":{"type":"number"},"new_start":{"type":"number"},"new_lines":{"type":"number"},"lines":{"type":"array","items":{"type":"string"}}},"required":["type"]}]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["tool_search_tool_result"]},"tool_use_id":{"type":"string"},"content":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["tool_search_tool_result_error"]},"error_code":{"type":"string","enum":["invalid_tool_input","unavailable","too_many_requests","execution_time_exceeded"]}},"required":["type","error_code"]},{"type":"object","properties":{"type":{"type":"string","enum":["tool_search_tool_search_result"]},"tool_references":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["tool_reference"]},"tool_name":{"type":"string"}},"required":["type","tool_name"]}}},"required":["type","tool_references"]}]}},"required":["type","tool_use_id","content"]},{"type":"object","properties":{"type":{"type":"string","enum":["redacted_thinking"]},"data":{"type":"string"}},"required":["type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["document"]},"source":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["base64"]},"media_type":{"type":"string","enum":["application/pdf","text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["text"]},"media_type":{"type":"string","enum":["text/plain"]},"data":{"type":"string"}},"required":["type","media_type","data"]},{"type":"object","properties":{"type":{"type":"string","enum":["url"]},"url":{"type":"string","format":"uri"}},"required":["type","url"]},{"type":"object","properties":{"type":{"type":"string","enum":["content"]},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"nullable":true}}]}},"required":["type","content"]}]},"title":{"type":"string"},"context":{"type":"string"}},"required":["type","source"]}]}}]}},"required":["role","content"]}},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"role":{"type":"string","enum":["system"],"description":"The role of the author of the message — in this case, the system."},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]}}],"description":"The contents of the system message."},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["role","content"]},{"type":"object","properties":{"role":{"type":"string","enum":["user"],"description":"The role of the author of the message — in this case, the user"},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["image_url"]},"image_url":{"type":"object","properties":{"url":{"anyOf":[{"type":"string","format":"uri"},{"type":"string"}],"description":"Either a URL of the image or the base64 encoded image data. "},"detail":{"type":"string","enum":["low","high","auto"],"description":"Specifies the detail level of the image. Currently supports JPG/JPEG, PNG, GIF, and WEBP formats."}},"required":["url"]}},"required":["type","image_url"]},{"type":"object","properties":{"type":{"type":"string","enum":["image"]},"source":{"type":"object","properties":{"type":{"type":"string","enum":["base64"]},"media_type":{"type":"string","enum":["image/jpeg","image/png","image/gif","image/webp"]},"data":{"type":"string"}},"required":["type","media_type","data"]}},"required":["type","source"]},{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]},{"type":"object","properties":{"type":{"type":"string","enum":["input_audio"],"description":"The type of the content part."},"input_audio":{"type":"object","properties":{"data":{"anyOf":[{"type":"string","format":"uri"},{"type":"string"},{"type":"string"}],"description":"Either a URL of the audio or the base64 encoded audio data."},"format":{"type":"string","enum":["wav","mp3","audio/x-aac","audio/flac","audio/mp3","audio/m4a","audio/mpeg","audio/mpga","audio/mp4","audio/ogg","audio/pcm","audio/webm"],"description":"The format of the encoded audio data. Currently supports \"wav\" and \"mp3\"."}},"required":["data","format"]}},"required":["type","input_audio"]},{"type":"object","properties":{"type":{"type":"string","enum":["file"],"description":"The type of the content part."},"file":{"type":"object","properties":{"file_data":{"type":"string","description":"The file data, encoded in base64 and passed to the model as a string. Only PDF format is supported.\n        - Maximum size per file: Up to 512 MB and up to 2 million tokens.\n        - Maximum number of files: Up to 20 files can be attached to a single GPT application or Assistant. This limit applies throughout the application's lifetime.\n        - Maximum total file storage per user: 10 GB."},"filename":{"type":"string","description":"The file name specified by the user. This name can be used to reference the file when interacting with the model, especially if multiple files are uploaded."}}}},"required":["type","file"]},{"type":"object","properties":{"type":{"type":"string","enum":["video_url"]},"video_url":{"type":"object","properties":{"url":{"anyOf":[{"type":"string","format":"uri"},{"type":"string"}],"description":"Base64-encoded local video file."}},"required":["url"]}},"required":["type","video_url"]}]}}],"description":"The contents of the user message."},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["role","content"]},{"type":"object","properties":{"role":{"type":"string","enum":["tool"],"description":"The role of the author of the message — in this case, the tool."},"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]}}],"description":"The contents of the tool message."},"tool_call_id":{"type":"string","description":"Tool call that this message is responding to."},"name":{"type":"string","nullable":true,"description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["role","content","tool_call_id"]},{"type":"object","properties":{"role":{"type":"string","enum":["function"]},"content":{"type":"string"},"name":{"type":"string"}},"required":["role","content","name"]},{"type":"object","properties":{"role":{"type":"string","enum":["assistant"],"description":"The role of the author of the message — in this case, the Assistant."},"content":{"anyOf":[{"type":"string","description":"The contents of the Assistant message."},{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]},{"type":"object","properties":{"refusal":{"type":"string","description":"The refusal message generated by the model."},"type":{"type":"string","enum":["refusal"],"description":"The type of the content part."}},"required":["refusal","type"]}]},"description":"An array of content parts with a defined type. Can be one or more of type text, or exactly one of type refusal."},{"nullable":true}],"description":"The contents of the Assistant message. Required unless tool_calls or function_call is specified."},"tool_calls":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","description":"The ID of the tool call."},"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only function is supported."},"function":{"type":"object","properties":{"name":{"type":"string","description":"The name of the function to call."},"arguments":{"type":"string","description":"The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function."}},"required":["name","arguments"],"description":"The function that the model called."}},"required":["id","type","function"]},{"type":"object","properties":{"id":{"type":"string","description":"The ID of the tool call."},"type":{"type":"string","enum":["custom"],"description":"The type of the tool. Currently, only function is supported."},"custom":{"type":"object","properties":{"name":{"type":"string","description":"The name of the custom tool to call."},"input":{"type":"string","description":"The input for the custom tool call generated by the model."}},"required":["name","input"],"description":"The custom tool that the model called."}},"required":["id","type","custom"]}]},"description":"The tool calls generated by the model, such as function calls."},"refusal":{"type":"string","nullable":true,"description":"The refusal message by the Assistant."},"audio":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"Unique identifier for a previous audio response from the model."}},"required":["id"],"description":"Data about a previous audio response from the model."},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["role"]},{"type":"object","properties":{"content":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"description":"The type of the content part."},"text":{"type":"string","description":"The text content."}},"required":["type","text"]}}],"description":"The contents of the developer message."},"role":{"type":"string","enum":["developer"],"description":"The role of the author of the message — in this case, the developer."},"name":{"type":"string","description":"An optional name for the participant. Provides the model information to differentiate between participants of the same role."}},"required":["content","role"]}]}}],"description":"A list of messages comprising the conversation so far. Depending on the model you use, different message types (modalities) are supported, like text, documents (txt, pdf), images, and audio."},"metadata":{"type":"object","additionalProperties":{"type":"string"},"description":"An object describing metadata about the request"},"stop_sequences":{"type":"array","items":{"type":"string"},"description":"Custom text sequences that will cause the model to stop generating."},"stream":{"type":"boolean","default":false,"description":"If set to True, the model response data will be streamed to the client as it is generated using server-sent events."},"system":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["text"],"default":"text"},"text":{"type":"string"},"citations":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["char_location"]},"cited_text":{"type":"string"},"document_index":{"type":"number"},"document_title":{"type":"string"},"end_char_index":{"type":"number"},"start_char_index":{"type":"number"}},"required":["type","cited_text","document_index","document_title","end_char_index","start_char_index"]},{"type":"object","properties":{"type":{"type":"string","enum":["page_location"]},"cited_text":{"type":"string"},"document_index":{"type":"number"},"document_title":{"type":"string"},"end_page_number":{"type":"number"},"start_page_number":{"type":"number"}},"required":["type","cited_text","document_index","document_title","end_page_number","start_page_number"]},{"type":"object","properties":{"type":{"type":"string","enum":["content_block_location"]},"cited_text":{"type":"string"},"document_index":{"type":"number"},"document_title":{"type":"string"},"end_block_index":{"type":"number"},"start_block_index":{"type":"number"}},"required":["type","cited_text","document_index","document_title","end_block_index","start_block_index"]},{"type":"object","properties":{"type":{"type":"string","enum":["web_search_result_location"]},"cited_text":{"type":"string"},"encrypted_index":{"type":"string"},"title":{"type":"string"},"url":{"type":"string"}},"required":["type","cited_text","encrypted_index","title","url"]},{"type":"object","properties":{"type":{"type":"string","enum":["search_result_location"]},"cited_text":{"type":"string"},"end_block_index":{"type":"number"},"search_result_index":{"type":"number"},"source":{"type":"string"},"start_block_index":{"type":"number"},"title":{"type":"string"}},"required":["type","cited_text","end_block_index","search_result_index","source","start_block_index","title"]}]}}},"required":["text"]}}],"description":"A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role."},"tool_choice":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["auto"]},"disable_parallel_tool_use":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["any"]},"disable_parallel_tool_use":{"type":"boolean"}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string","enum":["tool"]},"disable_parallel_tool_use":{"type":"boolean"}},"required":["name","type"]},{"type":"object","properties":{"type":{"type":"string","enum":["none"]}},"required":["type"]},{"type":"string","enum":["none","auto","required"],"description":"none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools."},{"type":"object","properties":{"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only function is supported."},"function":{"type":"object","properties":{"name":{"type":"string","description":"The name of the function to call."}},"required":["name"]}},"required":["type","function"],"description":"Specifies a tool the model should use. Use to force the model to call a specific function."},{"type":"object","properties":{"type":{"type":"string","enum":["allowed_tools"],"description":"The type of the tool. Currently, only function is supported."},"allowed_tools":{"type":"object","properties":{"mode":{"type":"string","enum":["auto","required"],"description":"Constrains the tools available to the model to a pre-defined set.\n- auto allows the model to pick from among the allowed tools and generate a message.\n- required requires the model to call one or more of the allowed tools."},"tools":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}},"description":"A list of tool definitions that the model should be allowed to call."}},"required":["mode","tools"]}},"required":["type","allowed_tools"],"description":"Constrains the tools available to the model to a pre-defined set."},{"type":"object","properties":{"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only function is supported."},"function":{"type":"string","enum":["name"],"description":"The name of the function to call."}},"required":["type","function"],"description":"Specifies a tool the model should use. Use to force the model to call a specific function."},{"type":"object","properties":{"type":{"type":"string","enum":["custom"],"description":"The type of the tool. Currently, only function is supported."},"custom":{"type":"string","enum":["name"],"description":"The name of the custom tool to call."}},"required":["type","custom"],"description":"Specifies a tool the model should use. Use to force the model to call a specific custom tool."}],"description":"Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. Specifying a particular tool via {\"type\": \"function\", \"function\": {\"name\": \"my_function\"}} forces the model to call that tool.\n  none is the default when no tools are present. auto is the default if tools are present."},"tools":{"anyOf":[{"type":"array","items":{"oneOf":[{"type":"object","properties":{"name":{"type":"string","description":"Name of the tool."},"description":{"type":"string","description":"Description of what this tool does.\n  Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema."},"input_schema":{"type":"object","properties":{"type":{"type":"string","enum":["object"]},"properties":{"nullable":true},"required":{"type":"array","items":{"type":"string"}}},"required":["type"],"additionalProperties":{"nullable":true},"description":"JSON schema for this tool's input.\n  This defines the shape of the input that your tool accepts and that the model will produce."},"type":{"type":"string","enum":["custom"]},"defer_loading":{"type":"boolean"},"eager_input_streaming":{"type":"boolean"},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["name","input_schema"]},{"type":"object","properties":{"name":{"type":"string","enum":["bash"],"default":"bash"},"type":{"type":"string","enum":["bash_20250124"]},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["code_execution"],"default":"code_execution"},"type":{"type":"string","enum":["code_execution_20250522"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["code_execution"],"default":"code_execution"},"type":{"type":"string","enum":["code_execution_20250825"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["code_execution"],"default":"code_execution"},"type":{"type":"string","enum":["code_execution_20260120"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["memory"],"default":"memory"},"type":{"type":"string","enum":["memory_20250818"]},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["str_replace_editor"],"default":"str_replace_editor"},"type":{"type":"string","enum":["text_editor_20250124"]},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["str_replace_based_edit_tool"],"default":"str_replace_based_edit_tool"},"type":{"type":"string","enum":["text_editor_20250429"]},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["str_replace_based_edit_tool"],"default":"str_replace_based_edit_tool"},"type":{"type":"string","enum":["text_editor_20250728"]},"max_characters":{"type":"number"},"input_examples":{"type":"array","items":{"type":"object","additionalProperties":{"nullable":true}}},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["web_search"],"default":"web_search"},"type":{"type":"string","enum":["web_search_20250305"]},"allowed_domains":{"type":"array","items":{"type":"string"}},"blocked_domains":{"type":"array","items":{"type":"string"}},"max_uses":{"type":"number"},"user_location":{"type":"object","properties":{"type":{"type":"string","enum":["approximate"]},"city":{"type":"string"},"country":{"type":"string"},"region":{"type":"string"},"timezone":{"type":"string"}},"required":["type"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["web_search"],"default":"web_search"},"type":{"type":"string","enum":["web_search_20260209"]},"allowed_domains":{"type":"array","items":{"type":"string"}},"blocked_domains":{"type":"array","items":{"type":"string"}},"max_uses":{"type":"number"},"user_location":{"type":"object","properties":{"type":{"type":"string","enum":["approximate"]},"city":{"type":"string"},"country":{"type":"string"},"region":{"type":"string"},"timezone":{"type":"string"}},"required":["type"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["web_fetch"],"default":"web_fetch"},"type":{"type":"string","enum":["web_fetch_20250910"]},"allowed_domains":{"type":"array","items":{"type":"string"}},"blocked_domains":{"type":"array","items":{"type":"string"}},"citations":{"type":"object","properties":{"enabled":{"type":"boolean"}}},"max_content_tokens":{"type":"number"},"max_uses":{"type":"number"},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["web_fetch"],"default":"web_fetch"},"type":{"type":"string","enum":["web_fetch_20260209"]},"allowed_domains":{"type":"array","items":{"type":"string"}},"blocked_domains":{"type":"array","items":{"type":"string"}},"citations":{"type":"object","properties":{"enabled":{"type":"boolean"}}},"max_content_tokens":{"type":"number"},"max_uses":{"type":"number"},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["web_fetch"],"default":"web_fetch"},"type":{"type":"string","enum":["web_fetch_20260309"]},"allowed_domains":{"type":"array","items":{"type":"string"}},"blocked_domains":{"type":"array","items":{"type":"string"}},"citations":{"type":"object","properties":{"enabled":{"type":"boolean"}}},"max_content_tokens":{"type":"number"},"max_uses":{"type":"number"},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["tool_search_tool_bm25"],"default":"tool_search_tool_bm25"},"type":{"type":"string","enum":["tool_search_tool_bm25_20251119","tool_search_tool_bm25"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]},{"type":"object","properties":{"name":{"type":"string","enum":["tool_search_tool_regex"],"default":"tool_search_tool_regex"},"type":{"type":"string","enum":["tool_search_tool_regex_20251119","tool_search_tool_regex"]},"defer_loading":{"type":"boolean"},"strict":{"type":"boolean"},"allowed_callers":{"type":"array","items":{"type":"string","enum":["direct","code_execution_20250825","code_execution_20260120"]}}},"required":["type"]}]}},{"type":"array","items":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["function"],"description":"The type of the tool. Currently, only function is supported."},"function":{"type":"object","properties":{"description":{"type":"string","description":"A description of what the function does, used by the model to choose when and how to call the function."},"name":{"type":"string","description":"The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64."},"parameters":{"type":"object","additionalProperties":{"nullable":true,"description":"The parameters the functions accepts, described as a JSON Schema object."}},"strict":{"type":"boolean","nullable":true,"description":"Whether to enable strict schema adherence when generating the function call. If set to True, the model will follow the exact schema defined in the parameters field. Only a subset of JSON Schema is supported when strict is True."}},"required":["name"],"additionalProperties":false}},"required":["type","function"]},{"type":"object","properties":{"type":{"type":"string","enum":["custom"],"description":"The type of the tool. Currently, only function is supported."},"custom":{"type":"object","properties":{"name":{"type":"string","description":"The name of the custom tool, used to identify it in tool calls."},"description":{"type":"string","description":"Optional description of the custom tool, used to provide more context."},"format":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["text"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["grammar"]},"grammar":{"type":"object","properties":{"definition":{"type":"string","description":"The grammar definition."},"syntax":{"type":"string","enum":["lark","regex"],"description":"The syntax of the grammar definition."}},"required":["definition","syntax"]}},"required":["type","grammar"]}],"description":"The input format for the custom tool. Default is unconstrained text."}},"required":["name","format"]}},"required":["type","custom"]}]}}],"description":"Definitions of tools that the model may use.\n  If you include tools in your API request, the model may return tool_use content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using tool_result content blocks.\n  Each tool definition includes:\n      name: Name of the tool.\n      description: Optional, but strongly-recommended description of the tool.\n      input_schema: JSON schema for the tool input shape that the model will produce in tool_use output content blocks."},"thinking":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["enabled"]},"budget_tokens":{"type":"integer","minimum":1024,"description":"Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. Must be ≥1024 and less than max_tokens."},"display":{"type":"string","enum":["summarized","omitted"],"default":"summarized"}},"required":["type","budget_tokens"]},{"type":"object","properties":{"type":{"type":"string","enum":["disabled"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["adaptive"]},"display":{"type":"string","enum":["summarized","omitted"],"default":"summarized"}},"required":["type"]}],"description":"Configuration for enabling Claude's extended thinking. When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your max_tokens limit."},"max_tokens":{"type":"number","default":128000,"description":"The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API."}},"required":["model","messages"]}]}}}},"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"model":{"type":"string","description":"Model used to generate the response."},"id":{"type":"string","description":"Unique identifier of the generated message."},"type":{"type":"string","description":"Object type."},"role":{"type":"string","description":"Role of the message author."},"content":{"type":"array","description":"Generated response content blocks.","items":{"type":"object","properties":{"type":{"type":"string","description":"Content block type."},"text":{"type":"string","description":"Generated text content."}},"required":["type","text"]}},"stop_reason":{"type":"string","nullable":true,"description":"Reason why generation stopped."},"stop_sequence":{"type":"string","nullable":true,"description":"Custom stop sequence that caused generation to stop."},"stop_details":{"nullable":true,"description":"Additional details about why generation stopped."},"usage":{"type":"object","description":"Token usage statistics for the request.","properties":{"input_tokens":{"type":"integer","description":"Number of input tokens used."},"cache_creation_input_tokens":{"type":"integer","description":"Number of tokens used for cache creation."},"cache_read_input_tokens":{"type":"integer","description":"Number of tokens retrieved from cache."},"cache_creation":{"type":"object","description":"Cache creation token statistics.","properties":{"ephemeral_5m_input_tokens":{"type":"integer","description":"Number of tokens cached for 5 minutes."},"ephemeral_1h_input_tokens":{"type":"integer","description":"Number of tokens cached for 1 hour."}},"required":["ephemeral_5m_input_tokens","ephemeral_1h_input_tokens"]},"output_tokens":{"type":"integer","description":"Number of output tokens generated."},"service_tier":{"type":"string","description":"Service tier used for inference."},"inference_geo":{"type":"string","description":"Geographic inference location."}},"required":["input_tokens","cache_creation_input_tokens","cache_read_input_tokens","cache_creation","output_tokens","service_tier","inference_geo"]},"meta":{"type":"object","description":"Additional metadata about the request.","properties":{"usage":{"type":"object","description":"Billing usage statistics.","properties":{"credits_used":{"type":"number","description":"Number of credits consumed."},"usd_spent":{"type":"number","description":"Amount spent in USD."}},"required":["credits_used","usd_spent"]}},"required":["usage"]}},"required":["model","id","type","role","content","usage"]}}}}}}}}}
```

### **Example: Simple Text Response**

{% tabs %}
{% tab title="Python" %}
{% code overflow="wrap" %}

```python
import requests
import json   # for getting a structured output with indentation

url = "https://api.aimlapi.com/messages"
headers = {
    # Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>: 
    "Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
    "Content-Type": "application/json"
}
payload = {
  "model": "claude-sonnet-4-20250514",
  "max_tokens": 1024,
  "system": "You are a robot. You always optimize for clarity, structure, and accuracy.",
  "messages": [
    {
      "role": "user",
      "content": "How are you?"
    }
  ]
}
response = requests.post(url, json=payload, headers=headers)
data = response.json()
print(json.dumps(data, indent=2, ensure_ascii=False))
```

{% endcode %}
{% endtab %}
{% endtabs %}

<details>

<summary>Response</summary>

{% code overflow="wrap" %}

```json5
{
  "model": "claude-sonnet-4-20250514",
  "id": "msg_01SUmNmSRFZsoa6h96MxJEHH",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "I'm functioning well, thank you for asking! I'm ready to help you with any questions or tasks you might have. How can I assist you today?"
    }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "stop_details": null,
  "usage": {
    "input_tokens": 27,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0,
    "cache_creation": {
      "ephemeral_5m_input_tokens": 0,
      "ephemeral_1h_input_tokens": 0
    },
    "output_tokens": 35,
    "service_tier": "standard",
    "inference_geo": "not_available"
  },
  "meta": {
    "usage": {
      "credits_used": 1576,
      "usd_spent": 0.000788
    }
  }
}
```

{% endcode %}

</details>

***

## **Function Calling**

To process text and use function calling, follow the examples below:

### **Example: Get Weather Information**

{% code overflow="wrap" %}

```python
import requests

url = "https://api.aimlapi.com/messages"
headers = {
    "Authorization": "Bearer YOUR_AIMLAPI_KEY",
    "Content-Type": "application/json"
}
payload = {
  "model": "anthropic/claude-sonnet-4.5",
  "max_tokens": 1024,
  "tools": [
    {
      "name": "get_weather",
      "description": "Get the current weather in a given location",
      "input_schema": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "The city and state, e.g. San Francisco, CA"
          }
        }
      }
    }
  ],
  "messages": [
    {
      "role": "user",
      "content": "What is the weather like in San Francisco?"
    }
  ]
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

{% endcode %}

***

## Streaming Mode

To enable streaming of responses, set `stream=True` in your request payload.

```python
import requests

url = "https://api.aimlapi.com/messages"
headers = {
    "Authorization": "Bearer YOUR_AIMLAPI_KEY",
    "Content-Type": "application/json"
}
payload = {
  "model": "anthropic/claude-sonnet-4.5",
  "max_tokens": 1024,
  "tools": [
    {
      "name": "get_weather",
      "description": "Get the current weather in a given location",
      "input_schema": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "The city and state, e.g. San Francisco, CA"
          }
        }
      }
    }
  ],
  "messages": [
    {
      "role": "user",
      "content": "What is the weather like in San Francisco?"
    }
  ]
```

***

## **Batch Processing**

Due to the complexity of its description, this capability has been placed on [a separate page](/capabilities/batch-processing.md).

***

## **Vision**

{% hint style="info" %}
**Note:** API only support [Base64 string](/glossary/concepts.md#base64) as image input.
{% endhint %}

Possible media types:

* `image/jpeg`
* `image/png`
* `image/gif`
* `image/webp`

{% code overflow="wrap" %}

```python
import httpx
import base64
from openai import OpenAI

client = OpenAI(
    base_url='https://api.aimlapi.com',
    api_key='<YOUR_AIMLAPI_KEY>'    
)  

image_url = "https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg"
image_media_type = "image/jpeg"
image_data = base64.standard_b64encode(httpx.get(image_url).content).decode("utf-8")

response = client.chat.completions.create(
    model="anthropic/claude-sonnet-4.5",
    messages=[
    {
        "role": "user",
        "content": [
            {
                "type": "image",
                "source": {
                    "type": "base64",
                    "media_type": image_media_type,
                    "data": imag1_data,
                },
            },
            {
                "type": "text",
                "text": "Describe this image."
            }
        ],
    }
],
)
print(response)
```

{% endcode %}

***

## Response Format

The responses from the AI/ML API for Anthropic models will typically include the generated text or results from the tool called. Here is an example response for a weather query:

{% code overflow="wrap" %}

```json
{
  "model": "claude-sonnet-4-20250514",
  "id": "msg_014iMvypzB9GafRthc8CQHsR",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "I'm doing well, thank you for asking! I'm here and ready to help with whatever you'd like to discuss or work on. How are you doing today?"
    }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "stop_details": null,
  "usage": {
    "input_tokens": 11,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0,
    "cache_creation": {
      "ephemeral_5m_input_tokens": 0,
      "ephemeral_1h_input_tokens": 0
    },
    "output_tokens": 37,
    "service_tier": "standard",
    "inference_geo": "not_available"
  },
  "meta": {
    "usage": {
      "credits_used": 1529,
      "usd_spent": 0.0007645
    }
  }
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aimlapi.com/api-references/text-models-llm/anthropic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
