AI Model Wiki

    Skip to main content
    6 min read
    Lesson 5 of 6

    Claude API & Tool Use

    From the course Anthropic Claude for Enterprise

    The Claude API enables developers to build sophisticated applications with tool use, vision, and structured outputs.

    Tool Use (Function Calling)

    Claude can use tools you define to interact with external systems:

    import anthropic
    
    client = anthropic.Anthropic()
    
    tools = [{
        "name": "search_database",
        "description": "Search the product database",
        "input_schema": {
            "type": "object",
            "properties": {
                "query": {"type": "string"},
                "category": {"type": "string", "enum": ["electronics", "clothing", "home"]}
            },
            "required": ["query"]
        }
    }]
    
    response = client.messages.create(
        model="claude-sonnet-4-20250514",
        max_tokens=1024,
        tools=tools,
        messages=[{"role": "user", "content": "Find me wireless headphones under $100"}]
    )
    

    Computer Use

    Claude can interact with computer interfaces — clicking, typing, scrolling, and reading screens:

    • Automate repetitive desktop tasks
    • Test web applications by navigating them
    • Fill out forms and process documents
    • Navigate complex software interfaces

    Vision

    Send images to Claude for analysis:

    • Screenshots for debugging
    • Documents and receipts for data extraction
    • Charts and graphs for interpretation
    • Product images for descriptions

    Prompt Caching

    Cache frequently used system prompts and documents:

    response = client.messages.create(
        model="claude-sonnet-4-20250514",
        system=[{
            "type": "text",
            "text": long_system_prompt,
            "cache_control": {"type": "ephemeral"}
        }],
        messages=[{"role": "user", "content": "Analyze this contract"}]
    )
    

    Caching reduces costs by 90% and latency by 85% for repeated prompts.

    Key Takeaways

    • •Tool use lets Claude interact with databases, APIs, and external systems
    • •Computer use enables Claude to control desktop interfaces autonomously
    • •Vision support handles screenshots, documents, charts, and product images
    • •Prompt caching reduces costs by 90% for repeated system prompts
    0 of 6 lessons marked complete

    Progress is kept in this browser only.