BrowserStack AI Evals

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
ParameterTypeDescription
pageintegerPage number
limitintegerItems 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/models

Define a custom model with your own pricing.

FieldTypeRequiredDescription
modelNamestringYesDisplay name (e.g., "my-finetune-v1")
matchPatternstringYesRegex pattern to match model names in traces
inputPricenumberNoCost per input token (USD)
outputPricenumberNoCost per output token (USD)
totalPricenumberNoCost per total token (if no input/output split)
unitstringNoTOKENS, CHARACTERS, MILLISECONDS, SECONDS, IMAGES, REQUESTS
startDateISO 8601NoDate from which this model definition is active
tokenizerIdstringNoTokenizer 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/media

Returns a pre-signed upload URL and a media ID.

FieldTypeRequiredDescription
contentTypestringYesMIME type (e.g., "image/png")
contentLengthintegerYesFile size in bytes
traceIdstringYesTrace to attach this media to
observationIdstringNoObservation to attach media to
fieldstringNoTrace/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.png

Get 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

UnitDescription
TOKENSPer token (most LLMs)
CHARACTERSPer character
MILLISECONDSPer millisecond (audio/video)
SECONDSPer second
IMAGESPer image generated
REQUESTSPer API request