Anthropic Hello World

SkillCommunication

Gives your agent a minimal working example of calling the Claude Messages API.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Anthropic Hello World skill

About this capability

'Create a minimal working Anthropic Claude Messages API example.

What this skill tells your AI

The instructions your AI receives, as published by jeremylongshore/tons-of-skills-marketplace in skills/.curated/anth-hello-world/SKILL.md and read by ahel’s review.

Overview

Three minimal examples covering the Claude Messages API core surfaces: basic text completion, vision (image analysis), and streaming responses.

Prerequisites

  • Completed anth-install-auth setup
  • Valid ANTHROPIC_API_KEY in environment
  • Python 3.8+ with anthropic package or Node.js 18+ with @anthropic-ai/sdk

Instructions

Example 1: Basic Text Message (Python)

import anthropic

client = anthropic.Anthropic()

message = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Explain quantum computing in 3 sentences."}
    ]
)

# Response structure
print(message.content[0].text)       # The actual text response
print(f"ID: {message.id}")           # msg_01XFDUDYJgAACzvnptvVoYEL
print(f"Model: {message.model}")     # claude-sonnet-4-20250514
print(f"Stop: {message.stop_reason}")# end_turn
print(f"Usage: {message.usage.input_tokens}in / {message.usage.output_tokens}out")

Example 2: Vision — Analyze an Image (TypeScript)

import Anthropic from '@anthropic-ai/sdk';
import * as fs from 'fs';

const client = new Anthropic();

// From file (base64)
const imageData = fs.readFileSync('chart.png').toString('base64');

const message = await client.messages.create({
  model: 'claude-sonnet-4-20250514',
  max_tokens: 1024,
  messages: [{
    role: 'user',
    content: [
      {
        type: 'image',
        source: {
          type: 'base64',
          media_type: 'image/png',
          data: imageData,
        },
      },
      { type: 'text', text: 'Describe what this chart shows.' },
    ],
  }],
});

console.log(message.content[0].type === 'text' ? message.content[0].text : '');

Example 3: Streaming Response (Python)

import anthropic

client = anthropic.Anthropic()

with client.messages.stream(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Write a haiku about APIs."}]
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)

# Get final message with full metadata
final = stream.get_final_message()
print(f"\nTokens used: {final.usage.input_tokens}+{final.usage.output_tokens}")

Output

  • Working code file with Claude client initialization
  • Successful API response with text content
  • Console output showing model response and usage metadata

Examples

Use the text example first when verifying credentials: send a fixed, short prompt and confirm that message.content[0].text is present before integrating the client into application code. Use the vision example only after that check passes and replace chart.png with a non-sensitive local fixture. For an interactive command-line feature, use the streaming example so text is emitted incrementally, then read the final message to capture token usage for logs or cost controls.

Error Handling

ErrorHTTP CodeCauseSolution
authentication_error401Invalid API keyCheck ANTHROPIC_API_KEY
invalid_request_error400Bad params (e.g., empty messages)Validate request body
rate_limit_error429Too many requestsImplement backoff (see anth-rate-limits)
overloaded_error529API temporarily overloadedRetry after 30-60s
api_error500Server errorRetry with exponential backoff

Key API Parameters

ParameterRequiredDescription
modelYesModel ID: claude-sonnet-4-20250514, claude-haiku-4-20250514, claude-opus-4-20250514
max_tokensYesMaximum output tokens (model-dependent max)
messagesYesArray of {role, content} objects
systemNoSystem prompt (string or content blocks)
temperatureNo0.0-1.0, default 1.0
top_pNoNucleus sampling (use temperature OR top_p)
stop_sequencesNoArray of strings that stop generation
streamNoEnable SSE streaming

Resources

Next Steps

Proceed to anth-local-dev-loop for development workflow setup.

Signals

GitHub stars
3k
Forks
396
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
anth-hello-world
Source
github.com/jeremylongshore/tons-of-skills-marketplace