Anthropic Request Builder

Build and preview Anthropic Claude API requests with code generation

Configuration

{
  "model": "claude-sonnet-4-20250514",
  "max_tokens": 1024,
  "system": "You are a helpful AI assistant.",
  "messages": [
    {
      "role": "user",
      "content": "Hello! How can you help me today?"
    }
  ]
}

Key Differences from OpenAI

  • • System prompt is a top-level parameter, not in messages array
  • • Uses max_tokens (required) not max_completion_tokens
  • • Temperature range: 0-1 (not 0-2)
  • • Has top_k in addition to top_p

Related Tools

Anthropic Messages API: Complete Request Builder Guide

The Anthropic Messages API is the interface for accessing Claude models — Claude 3.5 Sonnet, Claude 3 Opus, Claude 3.5 Haiku, and the latest Claude Sonnet 4. This request builder helps you configure API calls visually and generates ready-to-use code.

Claude models are known for strong instruction following, nuanced reasoning, and long context windows (up to 200K tokens). Use this tool to experiment with parameters and generate production-ready code.

Key API Differences vs OpenAI

FeatureAnthropicOpenAI
System promptTop-level system fieldIn messages array
Max tokensRequiredOptional
Temperature range0 to 10 to 2
Top K samplingSupportedNot available
Auth headerx-api-keyAuthorization: Bearer

Frequently Asked Questions

Which Claude model should I use?

Claude Sonnet 4 is the balanced choice for most tasks. Use Opus 4 for the most complex reasoning and creative tasks. Use Haiku 3.5 for fast, simple tasks at lower cost.

What is Top K sampling?

Top K limits token selection to the K most likely tokens. Unlike Top P which is probability-based, Top K is count-based. Use it for more predictable output variety. Set to 0 to disable.

Why is max_tokens required?

Anthropic requires explicit max_tokens to prevent unexpected costs from very long responses. Set it based on expected response length. Default is typically 1024 for chat, higher for longer content generation.

Related Tools