The Client class is the main entry point for all interactions with the Noxus AI platform. It handles authentication, request management, and provides access to all SDK resources including workflows, conversations, knowledge bases, and agents.
The client provides methods to retrieve platform capabilities:
Copy
Ask AI
# Get available workflow node typesnodes = client.get_nodes()print(f"Available node types: {len(nodes)}")# Get available AI modelsmodels = client.get_models()for model in models: print(f"Model: {model['name']} - {model['description']}")# Get chat model presetspresets = client.get_chat_presets()for preset in presets: print(f"Preset: {preset['name']} - {preset['model']}")
import osfrom noxus_sdk.client import Client# ✅ Good - use environment variablesclient = Client(api_key=os.getenv("NOXUS_API_KEY"))# ❌ Bad - hardcoded API keyclient = Client(api_key="noxus_1234567890abcdef")
Client Reuse
Create one client instance and reuse it throughout your application:
Copy
Ask AI
# ✅ Good - singleton patternclass NoxusService: _client = None @classmethod def get_client(cls): if cls._client is None: cls._client = Client(api_key=os.getenv("NOXUS_API_KEY")) return cls._client# Use throughout your appclient = NoxusService.get_client()
# ✅ Good - use paginationpage = 1while True: workflows = client.workflows.list(page=page, page_size=50) if not workflows: break process_workflows(workflows) page += 1# ❌ Bad - loading everything at onceall_workflows = client.workflows.list(page_size=10000)
For advanced use cases, you can customize the underlying HTTP client:
Copy
Ask AI
import httpxfrom noxus_sdk.client import Client# Create custom HTTP client with specific settingshttp_client = httpx.Client( timeout=60.0, limits=httpx.Limits(max_connections=100, max_keepalive_connections=20))# Note: This is a conceptual example - the actual SDK doesn't expose this yet# but it shows the kind of customization that might be useful
import loggingfrom noxus_sdk.client import Client# Configure logginglogging.basicConfig(level=logging.DEBUG)logger = logging.getLogger("noxus_sdk")client = Client(api_key="your_api_key")# Now all HTTP requests will be loggedworkflows = client.workflows.list()