πΌοΈImage Generations
Ever wanted to generate you with a girl for the first time? Then this is just for you.
import requests
url = "https://api.shard-ai.xyz/v1/images/generations"
data = {
"model": "dall-e-3", # Image model to use
"prompt": 'cat' # What to make
}
headers= {
"Authorization": "Bearer shard-xxx" # Your api key here.
}
r = requests.post(url, headers=headers, json=data)
print(r.text)
package main
import (
"fmt"
"log"
"github.com/valyala/fasthttp"
)
func main() {
// Define the URL for the Shard AI API endpoint.
apiURL := "https://api.shard-ai.xyz/v1/images/generations"
// Define the data to be sent in the request.
requestData := `{
"model": "dall-e-3",
"prompt": "kitty"
}`
// Provide the authorization token for accessing the API.
authorizationToken := "Bearer shard-xxx"
// Prepare the request.
req := fasthttp.AcquireRequest()
defer fasthttp.ReleaseRequest(req) // Don't forget to release
req.Header.SetContentType("application/json")
req.Header.SetMethod("POST")
req.Header.Set("Authorization", authorizationToken)
req.SetRequestURI(apiURL)
req.SetBodyString(requestData)
// Prepare the response.
resp := fasthttp.AcquireResponse()
defer fasthttp.ReleaseResponse(resp) // Don't forget to release
// Send the request.
if err := fasthttp.Do(req, resp); err != nil {
log.Fatalf("Error while making request: %s", err)
}
// Print the response received from the API.
fmt.Println(string(resp.Body()))
}
const fetch = require('node-fetch');
const url = "https://api.shard-ai.xyz/v1/images/generations";
const data = {
model: "dall-e-3", // Image model to use
prompt: 'cat' // What to make
};
const headers = {
"Authorization": "Bearer shard-xxx" // Your api key here.
};
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
...headers
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"created": 1714018966,
"data": [
{
"url": "https://oaidalleapiprodscus.blob.core.windows.net/private/org-euc5SXRBt8KFbPN02ZZcmgNv/user-tZtEPE4MMAX525WzOi4NT8Xb/img-THr2iVaq8fsQaoABIR0NP2o3.png?st=2024-04-25T03%3A22%3A46Z&se=2024-04-25T05%3A22%3A46Z&sp=r&sv=2021-08-06&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2024-04-24T19%3A14%3A28Z&ske=2024-04-25T19%3A14%3A28Z&sks=b&skv=2021-08-06&sig=NUODtb28vLRh0qjh73/rNZTpOYfIgCF%2Bm/RQdcfMOf8%3D"
}
]
}
This error means you have exceeded your rate limit! For basic users, your rate limit is a global limit of 15 requests a minute. Upgrade to premium to get more.
{
"error": {
"message": "Something went wrong, try again later.",
"type": "error",
"param": None,
"code": None
}
}
// Sorry, something went wrong, you can try contacting us @ discord.gg/ligma!
Last updated