Skip to main content

Python API client for Bytez service

Project description

API Documentation

Introduction

Welcome to the Bytez API documentation! This API provides access to various machine learning models for serverless operation. Below, you will find examples demonstrating how to interact with the API using our Python client library.

Getting Your Key

To use this API, you need an API key. Obtain your key by joining the Bytez Discord. If you prefer not to use Discord, email us at team@bytez.com.

Boot Times and Billing

Cold Boot Times

Expect the following boot times for models:

  • Smallest model: ~12 minutes.
  • Largest model: ~15 minutes. We are working on reducing these boot times to under 5 minutes.

Billing

Billing begins from the first 60 seconds of use, with subsequent usage rounded to the nearest minute. Charges are based on $0.0000166667 per GB-second on GPUs. The default expiration period for a model instance is 30 minutes.

Python Client Library Usage Examples

List Available Models

Retrieve a list of all available models.

from bytez_client import Bytez
api_key = 'YOUR_API_KEY'
client = Bytez(api_key)
models = client.list_models()
print(models)

List Serverless Instances

Get a list of your active serverless model instances.

instances = client.list_instances()
print(instances)

Make a Model Serverless

Submit a job to make a specific model serverless.

model_id = 'openai-community/gpt2'
job_status = client.process(model_id)
print(job_status)

Load a Model

Load a model with specified serverless configuration options.

options = {'concurrency': 1, 'timeout': 300}
loaded_model = client.model(model_id)
loaded_model.load(options)

Check Model Status

Retrieve the current status of a specific model.

status = loaded_model.status()
print(status)

Run a Model

Execute a model with the provided input and optional inference parameters.

input_text = "Once upon a time there was a"
output = loaded_model.run(input_text)
print(output)

Shutdown a Model

Stop a model and shut down the serverless instance.

shutdown_response = loaded_model.stop()
print(shutdown_response)

Authentication

Always include your API key when initializing the client:

client = Bytez(api_key='YOUR_API_KEY')

Feedback

We value your feedback to improve our documentation and services. If you have any suggestions, please join our Discord or contact us via email.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bytez-0.2.3.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

bytez-0.2.3-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page