PDF Support (Base64)
- Anthropic Messages API PDF document support (base64 format)
- Pass base64-encoded PDF files via
documentcontent parts - Supports
cache_control: ephemeralto optimize token usage for repeated documents - Official docs: PDF support
Authorizations
Request Body
ID of the model to use. See the model endpoint compatibility table for which models work with the Chat API.
List of messages in the conversation so far. See Python code examples.
Sampling temperature between 0 and 2. Higher values (e.g. 0.8) make output more random; lower values (e.g. 0.2) make it more focused and deterministic. We generally recommend changing either this or top_p, not both.
Nucleus sampling alternative to temperature: the model considers tokens with top_p probability mass. 0.1 means only the top 10% probability mass. We generally recommend changing either this or temperature, not both.
Defaults to 1.
How many chat completion choices to generate for each input message.
Defaults to false. If set, partial message deltas are sent like ChatGPT, as server-sent events ending with data: [DONE]. See Python code examples.
Defaults to null. Up to 4 sequences where the API stops generating further tokens.
Defaults to inf.
Maximum tokens to generate in the chat completion.
Total input + generated tokens is limited by the model context length. See Python examples for token counting.
Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the likelihood of new topics. More on frequency and presence penalties.
Defaults to 0. Number between -2.0 and 2.0. Positive values penalize new tokens based on their frequency in the text so far, reducing repetition. More on frequency and presence penalties.
Modify the likelihood of specified tokens appearing in the completion.
Accepts a JSON object mapping token IDs (from the tokenizer) to bias values (-100 to 100). Biases are added to logits before sampling. Effect varies by model; values between -1 and 1 should decrease or increase selection likelihood; -100 or 100 should ban or force selection.
Unique identifier for your end user to help OpenAI monitor and detect abuse. Learn more.
Object specifying the output format the model must use. { "type": "json_object" } enables JSON mode so messages are valid JSON. When using JSON mode, also instruct the model to produce JSON via system or user messages; otherwise it may stream whitespace until the token limit. If finish_reason="length", content may be truncated.
Beta feature. If specified, the system will attempt deterministic sampling so repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed; use system_fingerprint in the response to monitor backend changes.
List of tools the model may call. Currently only functions as tools are supported.
Controls which function the model calls, if any. none means no function call; auto lets the model choose; {"type": "function", "function": {"name": "my_function"}} forces a specific function. Defaults to none if no functions, auto if functions exist.