ccproxy.plugins.oauth_claude.models¶
ccproxy.plugins.oauth_claude.models
¶
Claude-specific authentication models.
ClaudeOAuthToken
¶
ClaudeCredentials
¶
Bases: BaseModel
Claude credentials from the credentials file.
is_expired
¶
Check if the credentials are expired.
Returns:
| Type | Description |
|---|---|
bool
|
True if expired, False otherwise |
model_dump
¶
Override model_dump to use by_alias=True by default.
to_dict
¶
from_dict
classmethod
¶
Create from dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
Dictionary containing credential data |
required |
Returns:
| Type | Description |
|---|---|
ClaudeCredentials
|
ClaudeCredentials instance |
Source code in ccproxy/plugins/oauth_claude/models.py
ClaudeTokenWrapper
¶
Bases: BaseTokenInfo
Wrapper for Claude credentials that adds computed properties.
This wrapper maintains the original ClaudeCredentials structure while providing a unified interface through BaseTokenInfo.
refresh_token_value
property
¶
Extract refresh token from Claude OAuth structure.
expires_at_datetime
property
¶
Convert Claude's millisecond timestamp to datetime.
subscription_type
property
¶
Compute subscription type from stored profile info.
Attempts to read the Claude profile file ("~/.claude/.account.json") and derive the subscription from account flags: - "max" if has_claude_max is true - "pro" if has_claude_pro is true - "free" otherwise
Falls back to the token's own subscription_type if profile is unavailable.
access_token_value
¶
ClaudeProfileInfo
¶
Bases: BaseProfileInfo
Claude-specific profile information from API.
Created from the /api/organizations/me endpoint response.
from_api_response
classmethod
¶
Create profile from Claude API response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
Response from /api/organizations/me endpoint |
required |
Returns:
| Type | Description |
|---|---|
ClaudeProfileInfo
|
ClaudeProfileInfo instance with all data preserved |