Python SDK
pip install ironlabsNode.js SDK
npm install ironlabsWhen to use Custom Router
- Cost optimization — route simple tasks to cheaper models, reserve powerful ones for complex requests
- Domain specialization — match prompts to models that excel in your domain (code, legal, creative writing, etc.)
- Multi-model pipelines — let the router decide which model handles each stage instead of hardcoding choices
- Replace guesswork — use a data-driven system trained on your own examples instead of manual model selection
Prerequisites
Before you start, make sure you have:
- An IronLabs API key from the Settings page
- A training data file hosted at a publicly accessible URL (GitHub, S3, CDN, etc.)
Installation
Install the SDK for your language:Initialize the client
Set your API key as an environment variable:Training a Custom Router
1
Prepare training data
Training data maps prompts to the ideal models for each. Supported formats are JSON and CSV — host your file at any publicly accessible URL (GitHub, S3, CDN, etc.).
2
Start training
Pass one or more data URLs to kick off a training job.Response:
3
Check training status
Poll until the job reaches Response:
completed or failed. Training typically takes a few minutes.4
Get model details
Retrieve metadata and performance metrics for your trained model.Response:
5
Run inference
Use your trained router to select the best model for new prompts.Response:Each prediction includes:
top_model— the recommended model for this inputtop_prob— confidence score (0–1)models— full ranked list with individual confidence scores
Complete example
View full end-to-end example
View full end-to-end example