Models & Media API
Manage LLM model definitions and upload media files.
Models & Media API
Models API
Model definitions control how token usage is priced and how model names are matched from traces. You can define custom models or use built-in ones.
List Models
GET /api/public/models| Parameter | Type | Description |
|---|---|---|
page | integer | Page number |
limit | integer | Items per page |
curl "https://evals-api.browserstack.com/api/public/models" \
-u "pk-lf-...:sk-lf-..."Response:
{
"data": [
{
"id": "model-uuid-1",
"modelName": "gpt-4o",
"matchPattern": "(?i)^(gpt-4o)$",
"startDate": null,
"inputPrice": 0.000005,
"outputPrice": 0.000015,
"totalPrice": null,
"unit": "TOKENS",
"tokenizerId": null,
"maintainedBy": "LANGFUSE",
"createdAt": "2026-01-01T00:00:00.000Z",
"updatedAt": "2026-01-01T00:00:00.000Z"
}
],
"meta": {
"page": 1,
"limit": 50,
"totalItems": 120,
"totalPages": 3
}
}Create Model
POST /api/public/modelsDefine a custom model with your own pricing.
| Field | Type | Required | Description |
|---|---|---|---|
modelName | string | Yes | Display name (e.g., "my-finetune-v1") |
matchPattern | string | Yes | Regex pattern to match model names in traces |
inputPrice | number | No | Cost per input token (USD) |
outputPrice | number | No | Cost per output token (USD) |
totalPrice | number | No | Cost per total token (if no input/output split) |
unit | string | No | TOKENS, CHARACTERS, MILLISECONDS, SECONDS, IMAGES, REQUESTS |
startDate | ISO 8601 | No | Date from which this model definition is active |
tokenizerId | string | No | Tokenizer to use for counting |
curl -X POST https://evals-api.browserstack.com/api/public/models \
-u "pk-lf-...:sk-lf-..." \
-H "Content-Type: application/json" \
-d '{
"modelName": "my-finetune-v1",
"matchPattern": "(?i)^(my-finetune-v1)$",
"inputPrice": 0.000002,
"outputPrice": 0.000006,
"unit": "TOKENS"
}'Delete Model
DELETE /api/public/models/{modelId}Only custom (project-owned) models can be deleted. Platform-maintained models cannot be removed.
curl -X DELETE "https://evals-api.browserstack.com/api/public/models/model-uuid-1" \
-u "pk-lf-...:sk-lf-..."Media API
The Media API allows uploading binary content (images, audio, documents) that can be attached to traces and observations.
Initialize Media Upload
POST /api/public/mediaReturns a pre-signed upload URL and a media ID.
| Field | Type | Required | Description |
|---|---|---|---|
contentType | string | Yes | MIME type (e.g., "image/png") |
contentLength | integer | Yes | File size in bytes |
traceId | string | Yes | Trace to attach this media to |
observationId | string | No | Observation to attach media to |
field | string | No | Trace/observation field: "input", "output", "metadata" |
curl -X POST https://evals-api.browserstack.com/api/public/media \
-u "pk-lf-...:sk-lf-..." \
-H "Content-Type: application/json" \
-d '{
"contentType": "image/png",
"contentLength": 102400,
"traceId": "trace-uuid-1",
"field": "input"
}'Response:
{
"mediaId": "media-uuid-1",
"uploadUrl": "https://storage.example.com/upload/...",
"uploadUrlExpiry": "2026-04-03T11:00:00.000Z"
}Upload the File
Use the returned uploadUrl to upload the file with a PUT request:
curl -X PUT "https://storage.example.com/upload/..." \
-H "Content-Type: image/png" \
--data-binary @/path/to/screenshot.pngGet Media
GET /api/public/media/{mediaId}Returns metadata and a temporary download URL.
curl "https://evals-api.browserstack.com/api/public/media/media-uuid-1" \
-u "pk-lf-...:sk-lf-..."Response:
{
"mediaId": "media-uuid-1",
"contentType": "image/png",
"contentLength": 102400,
"url": "https://storage.example.com/download/...",
"urlExpiry": "2026-04-03T11:00:00.000Z"
}Model Pricing Units
| Unit | Description |
|---|---|
TOKENS | Per token (most LLMs) |
CHARACTERS | Per character |
MILLISECONDS | Per millisecond (audio/video) |
SECONDS | Per second |
IMAGES | Per image generated |
REQUESTS | Per API request |