Quickstart
Get up and running with the PixAI API
The PixAI API are most easily accessed via the GraphQL endpoint. You can use any GraphQL client to interact with the API. Or even use it as a simple HTTP endpoint.
But the most easily way to get started is to use our SDK.
We provide SDKs for the following languages:
You can follow the instructions in the respective repositories to get started.
Most SDKs provide relatively complete encapsulation for calling our main interfaces.
Setting up the client
Here is an example using the JavaScript language:
You just need to pass your API key to the client. And this all you need to get started.
Start to generate images
After setting up the client, you can start to generate images. Here is an example of generating an image with text-to-image.
Get the result
In the task object, there will be a lot of information. If you just want to get the generated image, you can refer to the following code.
Download the image
In the JavaScript SDK. The obtained media may contain one or more images, depending on the batch
in the parameters. If you only generated one image. You can assert that there is only one media.
Afterwards, you can use the built-in method to directly download the image without concerning about the content of the media object.
Next steps
The above is the fastest way to start using the API. If you want to know more information or more usage, you can refer to the documentation of our SDK and other documents on this site.