Stability AI SDK API

A REST API service for upscaling images and generating videos using Stability AI's APIs.

API Endpoints

POST /api/v1/upscale

Upscale an image using Stability AI's upscaling API.

Supports fast, conservative, and creative upscaling types.

Required parameters:

Optional parameters:

GET /api/v1/upscale/result/{id}

Poll for the result of a creative upscale request.

Replace {id} with the ID returned from a creative upscale request.

POST /api/v1/image-to-video

Generate a video from an image using Stability AI's image-to-video API.

Required parameters:

Optional parameters:

GET /api/v1/image-to-video/result/{id}

Poll for the result of a video generation request.

Replace {id} with the ID returned from an image-to-video request.

GET /health

Check the health status of the API.

Authentication & Security

This API implements multiple layers of security:

1. API Key Authentication

All API endpoints (except /health) require authentication using a bearer token. Include the client API key in the Authorization header:

Authorization: Bearer your_client_api_key

Note: This client API key is different from the Stability AI API key. The Stability AI key is kept secure on the server.

2. App ID Authentication

If configured, each request must include an approved App ID in the X-App-ID header:

X-App-ID: your_approved_app_id

3. IP Address Filtering

The server can be configured to only accept requests from specific IP addresses.

4. Rate Limiting

The API implements rate limiting to prevent abuse.

Example Usage

Example of upscaling an image using the fast method:

curl -X POST https://stability-go.fly.dev/api/v1/upscale \
-H "Authorization: Bearer your_client_api_key" \
-H "X-App-ID: your_app_id" \
-F "image=@path/to/image.jpg" \
-F "type=fast"

Example of creative upscaling (returns an ID for polling):

curl -X POST https://stability-go.fly.dev/api/v1/upscale \
-H "Authorization: Bearer your_client_api_key" \
-H "X-App-ID: your_app_id" \
-F "image=@path/to/image.jpg" \
-F "type=creative" \
-F "prompt=high quality detailed fantasy landscape"

Polling for a creative upscale result:

curl -X GET https://stability-go.fly.dev/api/v1/upscale/result/your_id_here \
-H "Authorization: Bearer your_client_api_key" \
-H "X-App-ID: your_app_id"

GitHub Repository

https://github.com/marcusziade/stability-go