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§
- error
- Errors originating from API calls, parsing responses, and reading-or-writing to the file system.
- types
- Types used in API requests and responses. These types are created from component schemas in the OpenAPI spec
Structs§
- Client
- Client is a container of configurations to make API calls.
- Engines
- Enumerate available engines
- Generate
- Generate images from text, existing images, or both
- User
- Manage your Stability.ai account, and view account/organization balances
Constants§
- API_
BASE - Default v1 API base url
- CLIENT_
ID_ HEADER - Name for client id header
- CLIENT_
VERSION_ HEADER - Name for client version header
- ORGANIZATION_
HEADER - Name for organization header