Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions blockrun_llm/anthropic_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@

load_dotenv()

# Default chat HTTP timeout (seconds). Was 120; reasoning models (opus-4.8) think
# 200–300s+, which the old default cut off mid-generation. Override via the
# BLOCKRUN_CHAT_TIMEOUT env var. Mirrors client.py / solana_client.py.
DEFAULT_CHAT_TIMEOUT = float(os.environ.get("BLOCKRUN_CHAT_TIMEOUT", "600"))


class _BlockRunX402Transport(httpx.BaseTransport):
"""Custom httpx transport that intercepts 402 responses and signs x402 payments."""
Expand Down Expand Up @@ -123,7 +128,7 @@ def __init__(
self,
private_key: Optional[str] = None,
api_url: Optional[str] = None,
timeout: float = 120.0,
timeout: float = DEFAULT_CHAT_TIMEOUT,
**kwargs,
):
"""
Expand All @@ -133,7 +138,8 @@ def __init__(
private_key: Base chain wallet private key (or set BLOCKRUN_WALLET_KEY env var).
Key is used for LOCAL signing only — never transmitted.
api_url: BlockRun API endpoint (default: https://blockrun.ai/api).
timeout: Request timeout in seconds (default: 120).
timeout: Request timeout in seconds (default: 600, override via
BLOCKRUN_CHAT_TIMEOUT env). Reasoning models need 200–300s+.
**kwargs: Additional keyword arguments passed to anthropic.Anthropic.

Raises:
Expand Down
4 changes: 2 additions & 2 deletions blockrun_llm/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def __init__(
private_key: Base chain wallet private key (or set BLOCKRUN_WALLET_KEY env var)
NOTE: Key is used for LOCAL signing only - never transmitted
api_url: API endpoint URL (default: https://blockrun.ai/api)
timeout: Request timeout in seconds (default: 120). Used for regular chat requests.
timeout: Request timeout in seconds (default: 600, override via BLOCKRUN_CHAT_TIMEOUT env). Used for regular chat requests.
search_timeout: Timeout for xAI Live Search requests (default: 300 = 5 minutes).
Live Search can be slow as it searches X, web, and news sources.
Auto-detected when search_parameters or search=True is passed.
Expand Down Expand Up @@ -2202,7 +2202,7 @@ def __init__(
Args:
private_key: Base chain wallet private key (or set BLOCKRUN_WALLET_KEY env var)
api_url: API endpoint URL (default: https://blockrun.ai/api)
timeout: Request timeout in seconds (default: 120). Used for regular chat requests.
timeout: Request timeout in seconds (default: 600, override via BLOCKRUN_CHAT_TIMEOUT env). Used for regular chat requests.
search_timeout: Timeout for xAI Live Search requests (default: 300 = 5 minutes).
Auto-detected when search_parameters or search=True is passed.
transaction_log: Same opt-in per-call log as ``LLMClient``. ``True`` →
Expand Down
4 changes: 3 additions & 1 deletion blockrun_llm/solana_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def _create_signer(private_key: str) -> KeypairSigner:
#
# Public callers can also override per-call via ``timeout=`` on
# ``chat_completion`` / ``image`` / ``image_edit`` / ``search``.
DEFAULT_CHAT_TIMEOUT = float(os.environ.get("BLOCKRUN_CHAT_TIMEOUT", "600")) # was 120; reasoning models need 200–300s+
DEFAULT_CHAT_TIMEOUT = float(
os.environ.get("BLOCKRUN_CHAT_TIMEOUT", "600")
) # was 120; reasoning models need 200–300s+
DEFAULT_IMAGE_TIMEOUT = 200.0
DEFAULT_SEARCH_TIMEOUT = 300.0
DEFAULT_FAST_TIMEOUT = 30.0 # pyth / x_user_info / quick lookups
Expand Down
Loading