POST
/
models
/
v2
/
{modelId}
curl --request POST \
  --url https://api.bytez.com/models/v2/{modelId} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "text": "<string>",
  "messages": [
    {
      "role": "system",
      "content": "<string>"
    }
  ],
  "url": "<string>",
  "base64": "<string>",
  "question": "<string>",
  "context": "<string>",
  "candidate_labels": [
    "<string>"
  ],
  "stream": true,
  "json": true,
  "params": {
    "min_length": 123,
    "max_length": 123,
    "temperature": 123
  }
}'
{
  "error": null,
  "output": "<string>"
}

Authorizations

Authorization
string
header
required

Set Authorization header to Key BYTEZ_KEY (e.g. 'Authorization': 'Key ABC123')

Path Parameters

modelId
string
required

The model you want to run (e.g., openai-community/gpt2).

Body

application/json
The required inputs vary by task. For text-based tasks like text-generation, summarization, and translation, include the "text" field. For chat tasks, use "messages". For image tasks (like image-to-text, image-classification, object-detection, etc.), supply input using either "url" or "base64". For audio tasks such as automatic-speech-recognition, provide audio using "url" or "base64". Question-based tasks like question-answering require both "question" and "context". Zero-shot tasks need "candidate_labels" and may also require "text" or "image". Some tasks, like unconditional-image-generation, may not need any input. Always refer to the specific model's task to determine the required fields.
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.
url
string

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.

Response

200
application/json
Successful response from the model.
error
string

Null if everything is fine

Example:

null

output

Model output will either be a string, object, or array of items.