Both SDKs read NEURATEL_API_KEY automatically. Pass explicitly if needed:
Code
client = NeuratelAI(api_key="nk_live_...")
Code
const client = new NeuratelAI({ apiKey: "nk_live_..." });
Error handling
Code
from neuratelai import NeuratelAI, AuthenticationError, NotFoundError, RateLimitError, APIErrortry: agent = client.agents.get("ag_unknown")except AuthenticationError: print("Invalid API key")except NotFoundError: print("Agent not found")except RateLimitError: print("Rate limited — back off and retry")except APIError as e: print(f"Error {e.status_code}: {e}")
Class
HTTP
When
AuthenticationError
401
Invalid or missing API key
PermissionDeniedError
403
Insufficient permissions
NotFoundError
404
Resource doesn't exist
ConflictError
409
Duplicate resource
UnprocessableEntityError
422
Validation failed
RateLimitError
429
Too many requests
InternalServerError
5xx
Server error
APIConnectionError
—
Network failure
APITimeoutError
—
Request timed out
Retries
Both SDKs retry automatically on 429, 408, and 5xx with exponential backoff. Respects Retry-After headers.
Code
client = NeuratelAI(max_retries=3) # default: 2
Pagination
Code
# Auto-page through all agentsfor agent in client.agents.list().auto_paging_iter(): print(agent["id"])# Manual page controlpage = client.agents.list(limit=20)print(page.results) # items on this pageprint(page.metadata) # { total, skip, limit, has_more, count }
Both SDKs ship typed models generated from the canonical OpenAPI spec — import them via from neuratelai.types import VoiceSession, Agent (Python) or import type { Types } from "@neuratelai/sdk" (Node).