SLYD API Reference v1.0.0

The SLYD API provides programmatic access to all SLYD platform features, enabling you to deploy compute resources, manage applications, and interact with Benson AI.

Authentication

All API requests require authentication using an API key. To obtain your API key, visit the API Keys section in your account settings.

Base URL

All API endpoints are accessible from the following base URL:

Base URL
https://api.slyd.ai/v1

Authentication

Authentication is performed using an API key which should be included in all requests as a bearer token in the Authorization header:

Authentication Header
Authorization: Bearer your_api_key

Response Format

All API responses are returned in JSON format. Successful requests return a 2xx status code, while errors return appropriate 4xx or 5xx status codes with descriptive error messages.

Example Success Response
{
  "status": "success",
  "data": {
    "id": "inst_1234567890abcdef",
    "name": "llm-training",
    "status": "running",
    "created_at": "2025-03-24T08:30:45Z"
  }
}
Example Error Response
{
  "status": "error",
  "code": "unauthorized",
  "message": "Invalid API key provided",
  "request_id": "req_abcdefg123456"
}

Instances API

The Instances API allows you to create, manage, and monitor compute instances on the SLYD platform.

Create an Instance

Creates a new compute instance with the specified configuration.

Endpoint
POST /instances
Python
JavaScript
cURL
Create an instance with Python
import slyd

# Initialize the client with your API key
client = slyd.Client(api_key="your_api_key")

# Define instance configuration
instance_config = {
    "name": "llm-training",
    "hardware": {
        "gpu_model": "nvidia-a100",
        "gpu_count": 1,
        "cpu_cores": 32,
        "memory_gb": 128,
        "storage_gb": 1000
    },
    "applications": [
        {"id": "pytorch-2.0", "version": "latest"}
    ],
    "region": "us-west"
}

# Create the instance
instance = client.instances.create(instance_config)
print(f"Instance created: {instance.id}")
print(f"Status: {instance.status}")

# Wait for the instance to be ready
instance.wait_until_ready()
print(f"Instance is ready: {instance.ip_address}")
Create an instance with JavaScript
const SLYD = require('slyd-sdk');

// Initialize the client with your API key
const client = new SLYD.Client({ apiKey: 'your_api_key' });

// Define instance configuration
const instanceConfig = {
  name: 'llm-training',
  hardware: {
    gpu_model: 'nvidia-a100',
    gpu_count: 1,
    cpu_cores: 32,
    memory_gb: 128,
    storage_gb: 1000
  },
  applications: [
    { id: 'pytorch-2.0', version: 'latest' }
  ],
  region: 'us-west'
};

// Create the instance
async function createInstance() {
  try {
    const instance = await client.instances.create(instanceConfig);
    console.log(`Instance created: ${instance.id}`);
    console.log(`Status: ${instance.status}`);
    
    // Wait for the instance to be ready
    await instance.waitUntilReady();
    console.log(`Instance is ready: ${instance.ipAddress}`);
  } catch (error) {
    console.error('Error creating instance:', error);
  }
}

createInstance();
Create an instance with cURL
curl -X POST \
  https://api.slyd.ai/v1/instances \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "llm-training",
    "hardware": {
      "gpu_model": "nvidia-a100",
      "gpu_count": 1,
      "cpu_cores": 32,
      "memory_gb": 128,
      "storage_gb": 1000
    },
    "applications": [
      {"id": "pytorch-2.0", "version": "latest"}
    ],
    "region": "us-west"
  }'

List Instances

Retrieves a list of all instances in your account.

Endpoint
GET /instances
Example Request
import slyd

client = slyd.Client(api_key="your_api_key")

# List all instances
instances = client.instances.list()

# Print instance details
for instance in instances:
    print(f"ID: {instance.id}")
    print(f"Name: {instance.name}")
    print(f"Status: {instance.status}")
    print(f"Created: {instance.created_at}")
    print("---")

Get Instance Details

Retrieves detailed information about a specific instance.

Endpoint
GET /instances/{instance_id}
Example Request
import slyd

client = slyd.Client(api_key="your_api_key")

# Get instance details
instance_id = "inst_1234567890abcdef"
instance = client.instances.get(instance_id)

print(f"ID: {instance.id}")
print(f"Name: {instance.name}")
print(f"Status: {instance.status}")
print(f"IP Address: {instance.ip_address}")
print(f"Hardware: {instance.hardware}")
print(f"Applications: {instance.applications}")
print(f"Created: {instance.created_at}")

Benson AI API

The Benson AI API allows you to interact with Benson for resource recommendations and optimization.

Get Resource Recommendation

Requests a recommendation from Benson AI based on your project description and preferences.

Endpoint
POST /benson/recommend
Example Request
import slyd

client = slyd.Client(api_key="your_api_key")

# Ask Benson for a recommendation
recommendation = client.benson.recommend(
    project_description="I need to train a large language model with approximately 7 billion parameters. I have about 100GB of text data for training.",
    preferences={
        "budget": "medium",
        "priority": "speed",
        "framework": "pytorch"
    }
)

print(f"Recommendation ID: {recommendation.id}")
print(f"Recommended hardware: {recommendation.hardware}")
print(f"Estimated training time: {recommendation.estimated_time}")
print(f"Estimated cost: ${recommendation.estimated_cost}")

# Deploy the recommended configuration
instance = client.instances.create_from_recommendation(recommendation.id)
print(f"Instance created: {instance.id}")

API Reference Tables

Instances API Endpoints

Endpoint Method Description
/instances GET List all instances
/instances POST Create a new instance
/instances/{id} GET Get instance details
/instances/{id} DELETE Terminate an instance
/instances/{id}/start POST Start a stopped instance
/instances/{id}/stop POST Stop a running instance

Applications API Endpoints

Endpoint Method Description
/applications GET List all available applications
/applications/{id} GET Get application details
/applications/{id}/versions GET List available versions of an application
/instances/{id}/applications GET List applications installed on an instance
/instances/{id}/applications POST Install an application on an instance
/instances/{id}/applications/{app_id} DELETE Uninstall an application from an instance
An unhandled error has occurred. Reload 🗙