aboutsummaryrefslogtreecommitdiffstats
path: root/src/claude/__init__.py
blob: bb2f136d6c0c7cff480fd1daae60f83df9064a89 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""
claude-py: Python SDK for Claude API with streaming support.

Reverse engineered from Claude Code CLI v2.1.7 with exact API replication.

Basic usage:
    import asyncio
    from claude import ClaudeAgentClient

    async def main():
        async with ClaudeAgentClient() as client:
            # Streaming (recommended)
            async for chunk in client.send_message_stream("Hello!"):
                if chunk.text_delta:
                    print(chunk.text_delta, end='', flush=True)

            # Or non-streaming
            response = await client.send_message("What is 2+2?")
            print(response.content)

    asyncio.run(main())
"""

from .chat import ChatClient
from .client import ClaudeAgentClient, query
from .types import (
    AgentOptions,
    AssistantMessage,
    StreamChunk,
    TextContent,
    ToolHandler,
    ToolResult,
    ToolUse,
    Usage,
)

__version__ = "0.3.0"

__all__ = [
    "AgentOptions",
    "AssistantMessage",
    "ChatClient",
    "ClaudeAgentClient",
    "StreamChunk",
    "TextContent",
    "ToolHandler",
    "ToolResult",
    "ToolUse",
    "Usage",
    "query",
]