A TypeScript client for interacting with the GetImg API. This library provides methods to manage models, generate images, and query account details.
npm install getimg-client
To set up the client, configure it with your API key. Optionally, you can override the default API endpoint.
import { getimg } from 'getimg-client';
getimg.config({ key: 'YOUR_GETIMG_KEY' });
// Optionally override the API endpoint
getimg.config({ api: 'https://custom-api-endpoint.com' });
Retrieve a list of all available models:
const models = await getimg.listAllModels();
console.log(models);
Example response of the models:
[
{
"id": "stable-diffusion-v1-5",
"name": "Stable Diffusion v1.5",
"family": "stable-diffusion",
"pipelines": [
"text-to-image",
"image-to-image",
"controlnet"
],
"base_resolution": {
"width": 512,
"height": 512
},
"price": 0.00045,
"created_at": "2023-05-23T18:51:22.297Z"
}
]
Retrieve details of a specific model by its ID:
const model = await getimg.retrieveModel({ id: 'MODEL_ID' });
console.log(model);
The getimg.models
object provides access to various models and their capabilities. Each model includes a getModelName()
method to retrieve its name.
- fixFaces
- upscale
- textToImage
- textToImage
- textToImage
- imageToImage
- textToImage
- controlNet
- imageToImage
- inpainting
- instruct
- textToImage
- imageToImage
- inpainting
- ipAdapter
Example usage:
const modelName = getimg.models.stableDiffusion.getModelName();
console.log(modelName);
const result = await getimg.models.stableDiffusion.textToImage({ prompt: 'A beautiful landscape' });
console.log(result);
Retrieve account balance details:
const balance = await getimg.account.retrieveBalance();
console.log(balance);
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes.
- Submit a pull request.