Quickstart

Overview of CRUD Operations

The API supports Create, Read, Update, and Delete (CRUD) operations for managing and running open-source models on Bytez.

Create (PUT) - Create a Model Cluster

  • Endpoint: PUT /models/v2/openai-community/{model}
  • Purpose: Create an auto-scaling cluster for a specified model.
  • Request Body:
json
{
  "capacity": {
    "max": 5,
    "desired": 3
  },
  "timeout": 3600
}
  • Response: Confirms successful cluster creation.

Read (GET) - Retrieve Model Cluster Information

  • Endpoint: GET /models/v2/openai-community/{model}
  • Purpose: Fetch information about the specified model cluster.
  • Response:
json
{
  "cluster": {
    "status": "running",
    "capacity": {
      "max": 5,
      "desired": 3
    }
  }
}

Update (PATCH) - Modify an Existing Model Cluster

  • Endpoint: PATCH /models/v2/openai-community/{model}
  • Purpose: Update capacity or configuration of a model cluster.
  • Request Body:
json
{
  "capacity": {
    "desired": 4
  }
}
  • Response: Confirms successful cluster update.

Delete (DELETE) - Remove a Model Cluster

  • Endpoint: DELETE /models/v2/openai-community/{model}
  • Purpose: Delete the specified model cluster.
  • Response: Confirms successful deletion.
Inference (POST) - Execute a Model
- `Endpoint`: POST /models/v2/openai-community/{model}
- `Purpose`: Run inference on an open-source model.
- `Request Body`:
```json json
{
  "text": "Hello, how are you?",
  "stream": false,
  "params": {
    "min_length": 10,
    "max_length": 50
  }
}
  • Response:
{
  "output": "I am doing well, thank you!"
}

Unified Input Formats

Bytez simplifies building with 40k+ Open Source and Closed Source AI models by standardizing inputs across 33 ML tasks. This consistency eliminates the need to adjust for varying input structures, allowing seamless integration for text, messages, image, or multiple inputs.

Why Standardization?

  • Reduces integration complexity.
  • Enables task/provider switching without reformatting inputs.

Input Schemas

Text

For models that process text:

json
{
  "text": "Input text",
  "stream": false,
  "params": { "max_length": 100, "temperature": 0.7 }
}

Tasks: Fill Mask, Summarization, Text-to-Speech, Translation, Text Generation, etc.

Messages

For chat and multi-modal tasks:

json
{
  "messages": [
    { "role": "system", "content": "You are a helpful assistant." },
    { "role": "user", "content": "What's the weather like today?" }
  ]
}

Tasks: Chat.

Image

For image processing, use either:

URL:

json
{ "image_url": "https://example.com/image.jpg" }

Base64:

json
{ "base64": "data:image/webp;base64,..." }

Tasks: Image Classification, Object Detection, Image-to-Text.

Multi-Input

For models needing both text and image or audio or video:

json
{
  "text": "What's in the image?",
  "image_url": "https://example.com/image.jpg"
}

Tasks: Visual Question Answering, Zero-Shot Classification, etc.

This unified schema accelerates development and ensures compatibility across diverse AI tasks.