---
title: "Run Model"
method: POST
path: "/models/v2/{modelId}"
---

# Run Model

`POST /models/v2/{modelId}`

Runs an open/closed model. Acts serverlessly. (We manage everything behind the scenes.)

## Path parameters

- `modelId` string, required

## Request body

- object
  - `text` string — Input text to be processed by the model (used for most NLP tasks).
  - `messages` object[] — An array of chat messages representing the conversation history. Each message must have a `role` (`system`, `user`, or `assistant`) and `content`. The `content` can be: - A simple string - An array of content blocks where each block has a `type` (e.g. `text`, `image`, `audio`, or `video`) and the corresponding data via `text`, `url`, or `base64`.
    - `role` 'system' | 'user' | 'assistant', required — The sender of the message.
    - `content` union, required
      - string — Text-only message content.
      - object[] — Multi-modal message content blocks.
        - `type` 'text' | 'image' | 'audio' | 'video', required — The type of content block.
        - `text` string — Text content (used with type 'text').
        - `url` string, uri — HTTP URL to image/audio/video (used with type 'image/audio/video').
        - `base64` string — Base64-encoded image/audio/video (used with type 'image/audio/video').
  - `url` string, uri — URL to an image, audio, or video file (used for image/audio/video tasks).
  - `base64` string — Handles Base64-encoded image, audio, or video. Using URLs is recommended to avoid large payloads, which slow your requests down.
  - `question` string — Question text (used in question-answering tasks).
  - `context` string — Context paragraph (used in question-answering).
  - `candidate_labels` string[] — List of candidate labels (used in zero-shot tasks).
  - `stream` boolean — Enable/disable text streaming.
  - `json` boolean — Similar to stream, but for media. Streams back media instead returning it in JSON format.
  - `params` object — Model-specific parameters. See model documentation for details.
    - `max_new_tokens` integer — Maximum length of the response.
    - `temperature` number — Sampling temperature for generation.

## Response `200`

Successful response from the model.

- object
  - `error` string — Null if everything is fine
  - `output` union — Model output will either be a string, object, or array of items.
    - string
    - object
    - unknown[]
      - unknown

## Other responses

- `401` — Auth error - check your api key and how you're sending it.
- `429` — Too Many Requests – You have hit the rate limit.

---

[API](https://skmtc.net/bytez/apis/closed-source-model-api.md) · [All operations](https://skmtc.net/bytez/apis/closed-source-model-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/bytez/closed-source-model-api/versions/d64c9c733afe/schema)
