Introduction
The Models API gives you Stylor's own models directly. You name a model, send its input and get its output. It does not read your catalogue or keep any state between calls.
The first model is stylor-segment-v1. It finds every garment and accessory in a photo and returns a mask for each one.
Base URL and authentication
All requests go to:
https://stylor.ai/apiEvery model endpoint takes an organization public API key as a Bearer token. Private keys are rejected with 401, and the demo key cannot call model endpoints.
curl https://stylor.ai/api/v2/models/segment \
-H "Authorization: Bearer $STYLOR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"stylor-segment-v1","image":"https://example.com/look.jpg"}'Models
| Model | Endpoint | What it does | Metered as |
|---|---|---|---|
stylor-segment-v1 |
POST /v2/models/segment |
Every garment and accessory in a photo, each with its label, box and mask. | api.v2.models.segment |
What a model name promises
A model's name is a contract:
- Its request fields, its response fields and its set of labels do not change.
- Its answers may improve. We can improve the model behind a name without notice, as long as the contract holds.
- A model that changes its request, response or labels gets a new name. The old name keeps working.
Send model on every request. If you leave it out you get the endpoint's current default, which can change to a newer model.
Speed
- A request normally answers in about a second.
- A model that has not been called for a while can need longer to be ready than a request waits. The endpoint then answers
503with aRetry-Afterheader. Send the same request again after that many seconds.
Errors and retries shows a retry loop that handles this.
Limits and metering
Each endpoint has its own quota and requests-per-minute limit, reported in the X-RateLimit-* headers on every response. A request that ends in a 5xx answer does not use quota.
Your photos
A photo you send is read in memory, run through the model and dropped. It is not stored and not logged. When you send a URL, our server fetches it once.