claude-sonnet-4

Neural Network

Claude Sonnet 4 significantly enhances the capabilities of its predecessor, Sonnet 3.7, excelling in both coding and reasoning tasks with improved precision and controllability. Achieving state-of-the-art performance on SWE-bench (72.7%), Sonnet 4 balances capability and computational efficiency, making it suitable for a broad range of applications from routine coding tasks to complex software development projects

Main

/

Models

/

claude-sonnet-4
64 000

Max answer length

(in tokens)

200 000

Context size

(in tokens)

3 $

Prompt cost

(per 1M tokens)

15 $

Answer cost

(per 1M tokens)

0 $

Image prompt

(per 1K tokens)

Overview
Providers
API
bothub
BotHub: Try GPT Chat for Freebot

Caps remaining: 0 CAPS
Providers claude-sonnet-4On Bothub, you can select your own providers for requests. If you haven't made a selection, we will automatically find suitable providers who can handle the size and parameters of your request.
Code example and API for claude-sonnet-4We offer full access to the OpenAI API through our service. All our endpoints fully comply with OpenAI endpoints and can be used both with plugins and when developing your own software through the SDK.Create API key
Javascript
Python
Curl
import OpenAI from 'openai';
const openai = new OpenAI({
  apiKey: '<your bothub access token>',
  baseURL: 'https://bothub.chat/api/v2/openai/v1'
});


// Sync - Text generation 

async function main() {
  const chatCompletion = await openai.chat.completions.create({
    messages: [{ role: 'user', content: 'Say this is a test' }],
    model: 'claude-sonnet-4',
  });
} 

// Async - Text generation 

async function main() {
  const stream = await openai.chat.completions.create({
    messages: [{ role: 'user', content: 'Say this is a test' }],
    model: 'claude-sonnet-4',
    stream: true
  });

  for await (const chunk of stream) {
    const part: string | null = chunk.choices[0].delta?.content ?? null;
  }
} 
main();
illustaration

How it works claude-sonnet-4?

This model's key enhancements include improved autonomous codebase navigation, reduced error rates in agent-driven workflows, and increased reliability in following intricate instructions. Sonnet 4 is optimized for practical everyday use, providing advanced reasoning capabilities while maintaining efficiency and responsiveness in diverse internal and external scenarios.