Skip to main content
You can use the API with any programming language that can make HTTP requests, but we recommend using one of our official SDKs for ease of use and convenience.We have libraries for Python, JavaScript, and Julia. Using Python 3.9+, JavaScript, or Julia, install the appropriate package:
  // use your favorite package manager
  npm i bytez.js
  yarn add bytez.js
Bytez allows you to use open-source and closed-source models with a single API key.

Use open-source models

  1. Copy your key from the API Dashboard.
  2. Use your Bytez Key in requests
import Bytez from "bytez.js";

const sdk = new Bytez("BYTEZ_KEY");
You’re now set to use open source models on Bytez!

Use closed-source models

To use a closed-source model, you’ll need an account with the model provider. For example, if you want to use OpenAI models, you’ll need an OpenAI key. We call your closed source key a “provider key”
  1. Copy your key from the API Dashboard.
  2. Use your Bytez Key AND closed-source provider key in requests.
# add a "provider-key" header, and set its value to "{KEY}"
curl -X GET "https://api.bytez.com/models/v2/some-endpoint" \
  -H "Authorization: BYTEZ_KEY" \
  -H "provider-key: {your-key}"

Bytez API Key Security & Usage

We securely route your requests as a pass-through service. Your API keys are never stored or logged by Bytez; they are only used to authenticate directly with the model provider.Recommendation: Use a dedicated API key for Bytez for maximum security and traceability.
  • Billing: No extra Bytez fees for closed-source models; you’re billed directly by the provider based on usage associated with your key.
  • Integration: Seamlessly use the same input format for all models (open and closed-source).
If you need help with any of this, please DM us in Discord or submit an issue on GitHub. We’re happy to help.
Running is a model is easy. Just select the model and pass it an input
import Bytez from "bytez.js";

const sdk = new Bytez("BYTEZ_KEY");
const modelId = "openai-community/gpt-2"
const model = sdk.model(model_id)

const { error, output } = await model.run("Once upon a time")

console.log({ error, output });

Read more about our schema by visiting our HTTP reference.
You can list all the tasks, models, and running models using the API.

Tasks

A task defines a specific function a model performs (e.g., object-detection). Multiple models might be available for the same task. To list all tasks supported by Bytez, run the following command:
import Bytez from "bytez.js";

const sdk = new Bytez("BYTEZ_KEY");

const { error, output } = await sdk.list.tasks()

console.log({ error, output });

Models

A model refers to a software function with unique identifier. Models execute tasks. For example, the model google/vit-base-patch16-224 executes image-classification. To list all open-source models supported by Bytez, run the following command:
import Bytez from "bytez.js";

const sdk = new Bytez("BYTEZ_KEY");

const { error, output } = await sdk.list.models()

console.log({ error, output });