Crate stabilityai
source ·Expand description
Rust library for stability.ai based on OpenAPI spec.
Creating client
use stabilityai::Client;
// Create a client with api key from env var STABILITY_API_KEY and default base url.
let client = Client::new();
// OR use API key from different source and a non default organization
let api_key = "sk-..."; // This secret could be from a file, or environment variable.
let client = Client::new()
.with_api_key(api_key)
.with_organization("the-continental");
// Use custom reqwest client
let http_client = reqwest::ClientBuilder::new()
.user_agent("Rust/stabilityai")
.build().unwrap();
let client = Client::new()
.with_http_client(http_client);
Making requests
use stabilityai::Client;
// Create client
let client = Client::new();
// Call API
let response = client
.user()
.account()
.await
.unwrap();
println!("{:#?}", response);
Examples
For full working examples see examples directory in the repository.
Modules
- Errors originating from API calls, parsing responses, and reading-or-writing to the file system.
- Types used in API requests and responses. These types are created from component schemas in the OpenAPI spec
Structs
- Client is a container of configurations to make API calls.
- Enumerate available engines
- Generate images from text, existing images, or both
- Manage your Stability.ai account, and view account/organization balances
Constants
- Default v1 API base url
- Name for client id header
- Name for client version header
- Name for organization header