Scale GP Python API Library

The Scale GP Python library provides convenient access to the Scale GP REST API from any Python 3.9+ application. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients powered by httpx.

Documentation

The REST API documentation can be found on docs.gp.scale.com.

Installation

pip install scale-gp-beta

Usage

import os
from scale_gp_beta import SGPClient

client = SGPClient(
    account_id="My Account ID",
    api_key=os.environ.get("SGP_API_KEY"),  # This is the default and can be omitted
    # or 'production' | 'staging' | 'development' | 'local'; defaults to "production".
    environment="production-multitenant",
)

completion = client.chat.completions.create(
    messages=[{
        "role": "user",
        "content": "Hello, how are you?",
    }],
    model="openai/gpt-4o-mini",
    top_k=2,
)

While you can provide an api_key keyword argument, we recommend using python-dotenv to add SGP_API_KEY="My API Key" to your .env file so that your API Key is not stored in source control.