ccproxy.claude_sdk.client¶
ccproxy.claude_sdk.client
¶
Claude SDK client wrapper for handling core Claude Code SDK interactions.
ClaudeSDKConnectionError
¶
Bases: ClaudeSDKError
Raised when unable to connect to Claude Code.
ClaudeSDKProcessError
¶
Bases: ClaudeSDKError
Raised when Claude Code process fails.
ClaudeSDKClient
¶
Minimal Claude SDK client wrapper that handles core SDK interactions.
This class provides a clean interface to the Claude Code SDK while handling error translation and basic query execution.
Source code in ccproxy/claude_sdk/client.py
query_completion
async
¶
Execute a query using the Claude Code SDK.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prompt
|
str
|
The prompt string to send to Claude |
required |
options
|
ClaudeCodeOptions
|
Claude Code options configuration |
required |
request_id
|
str | None
|
Optional request ID for correlation |
None
|
Yields:
Type | Description |
---|---|
AsyncIterator[UserMessage | AssistantMessage | SystemMessage | ResultMessage]
|
Messages from the Claude Code SDK |
Raises:
Type | Description |
---|---|
ClaudeSDKError
|
If the query fails |
Source code in ccproxy/claude_sdk/client.py
get_last_api_call_time_ms
¶
Get the duration of the last Claude API call in milliseconds.
Returns:
Type | Description |
---|---|
float
|
Duration in milliseconds, or 0.0 if no call has been made yet |
validate_health
async
¶
Validate that the Claude SDK is healthy.
Returns:
Type | Description |
---|---|
bool
|
True if healthy, False otherwise |