PhoenixGenAI
Query a Task
Calling the genAI interface will return a task id, which is the unique identifier for each call. You can use the task id to query the results of the task.
Polling
GET
https://www.phoenix.global/sdk/computation/genAI/queryTask
Headers
token*
string
The token generated in the previous step
Query Parameters
task_id*
string
Task id
Response
{
"code": 200,
"msg": "Success",
"task_id": "40a5a249-xxxx-xxxx-9ede-0618df6e77e0",
"result_url": "https://xxxxxx.jpg"
}
CURL and Golang SDK
curl --location 'https://www.phoenix.global/sdk/computation/genAI/queryTask?task_id=40a5a249-xxxx-xxxx-9ede-0618df6e77e0' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs'
Websocket Streaming
WSS
wss://www.phoenix.global/sdk/ws/watch/all
Headers
token*
string
The token generated in the previous step
Response
{
"task_id": "9ef3a517-xxxx-11ef-8c58-0618df6e77e0",
"result_url": "https://phoenix.global/ai/files/xxxxxx.jpg"
}
Golang Demo
Demo of using Go language to connect to WSS and read messages.
package main
import (
"fmt"
"github.com/gorilla/websocket"
)
func main() {
url := "wss://www.phoenix.global/sdk/ws/watch/all"
token := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjY2NDk2MjE4NUBxcS5jb20iLCJleHAiOjE2OTk0MzA2Mjh9.l4SpDbOiitrTeJ4Zr89c4ZecXpY9K4DlpZAK9mWrcBw"
headers := make(map[string][]string)
headers["Token"] = []string{token}
dialer := websocket.DefaultDialer
conn, _, err := dialer.Dial(url, headers)
if err != nil {
fmt.Println("failed to connect to websocket: " + err.Error())
return
}
defer conn.Close()
for {
_, message, err := conn.ReadMessage()
if err != nil {
fmt.Println("failed to read message: " + err.Error())
return
}
fmt.Println(string(message))
}
}
Base GenAI
Generating an image by base mode.
POST
https://www.phoenix.global/sdk/computation/genAI/genImg
Headers
token*
string
The token generated in the previous step
Request Body
prompt*
string
Prompt
negative_prompt
string
Negative prompt
Response
{
"code": 200,
"msg": "success",
"task_id": "40a5a249-xxxx-11ef-9ede-0618df6e77e0",
"token_cost": 1024, //The number of tokens consumed by this request
"token_balance": 137542 //The remaining number of tokens
}
CURL and Golang SDK
curl --location 'https://www.phoenix.global/sdk/computation/genAI/genImg' \
--header 'Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "iron man skiing on steep slope, hd, high quality",
"negative_prompt": "ugly,watermark,jpeg artifacts,error,text,username"
}'
SDXL GenAI
Generating an image by SDXL mode.
POST
https://www.phoenix.global/sdk/computation/genAI/genImgSDXL
Headers
token*
string
The token generated in the previous step
Request Body
prompt*
string
Prompt
negative_prompt
string
Negative prompt
Response
{
"code": 200,
"msg": "success",
"task_id": "40a5a249-xxxx-11ef-9ede-0618df6e77e0",
"token_cost": 1024, //The number of tokens consumed by this request
"token_balance": 137542 //The remaining number of tokens
}
CURL and Golang SDK
curl --location 'https://www.phoenix.global/sdk/computation/genAI/genImgSDXL' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "iron man skiing on steep slope, hd, high quality",
"negative_prompt": "ugly,watermark,jpeg artifacts,error,text,username"
}'
Flux GenAI
Generating an image by Flux mode.
POST
https://www.phoenix.global/sdk/computation/genAI/genImgFlux
Headers
token*
string
The token generated in the previous step
Request Body
prompt*
string
Prompt
Response
{
"code": 200,
"msg": "success",
"task_id": "40a5a249-xxxx-11ef-9ede-0618df6e77e0",
"token_cost": 1024, //The number of tokens consumed by this request
"token_balance": 137542 //The remaining number of tokens
}
CURL and Golang SDK
curl --location 'https://www.phoenix.global/sdk/computation/genAI/genImgFlux' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "iron man skiing on steep slope, hd, high quality"
}'
Text to Motion
Generating a gif from prompts.
POST
https://www.phoenix.global/sdk/computation/genAI/txt2Motion
Headers
token*
string
The token generated in the previous step
Request Body
prompt*
string
Prompt
negative_prompt
string
Negative prompt
Response
{
"code": 200,
"msg": "success",
"task_id": "40a5a249-xxxx-11ef-9ede-0618df6e77e0",
"token_cost": 1024, //The number of tokens consumed by this request
"token_balance": 137542 //The remaining number of tokens
}
CURL and Golang SDK
curl --location 'https://www.phoenix.global/sdk/computation/LLM/callTextToMotion' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "a flying phoenix",
"negative_prompt": "blurry"
}'
Image to Motion
Generating a gif from an image
POST
https://genapi.phoenix.global/sdk/computation/genAI/img2Motion
Headers
Token*
string
The token generated in the previous step
Request Body
image_path*
string
Image URL
prompt*
string
Prompt
Response
{
"code": 200,
"msg": "success",
"task_id": "40a5a249-xxxx-11ef-9ede-0618df6e77e0",
"token_cost": 1024, //The number of tokens consumed by this request
"token_balance": 137542 //The remaining number of tokens
}
CURL and Golang SDK
curl --location 'https://www.phoenix.global/sdk/computation/genAI/img2Motion' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs' \
--header 'Content-Type: application/json' \
--data-raw '{
"prompt": "a flying phoenix",
"img_url": "https://phoenix.global/ai/files/LLM/[email protected]/phoenix.jpg"
}'
CogVideo
Generating a gif by CogVideo mode
POST
https://genapi.phoenix.global/sdk/computation/genAI/cogVideo
Headers
Token*
string
The token generated in the previous step
Request Body
prompt*
string
Prompt
Response
{
"code": 200,
"msg": "success",
"task_id": "40a5a249-xxxx-11ef-9ede-0618df6e77e0",
"token_cost": 1024, //The number of tokens consumed by this request
"token_balance": 137542 //The remaining number of tokens
}
CURL and Golang SDK
curl --location 'https://www.phoenix.global/sdk/computation/genAI/cogVideo' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs' \
--header 'Content-Type: application/json' \
--data-raw '{
"prompt": "a flying phoenix",
}'
Pyramid
Generating a gif by Pyramid mode
POST
https://genapi.phoenix.global/sdk/computation/genAI/pyramid
Headers
Token*
string
The token generated in the previous step
Request Body
prompt*
string
Prompt
Response
{
"code": 200,
"msg": "success",
"task_id": "40a5a249-xxxx-11ef-9ede-0618df6e77e0",
"token_cost": 1024, //The number of tokens consumed by this request
"token_balance": 137542 //The remaining number of tokens
}
CURL and Golang SDK
curl --location 'https://www.phoenix.global/sdk/computation/genAI/pyramid' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs' \
--header 'Content-Type: application/json' \
--data-raw '{
"prompt": "a flying phoenix",
}'
Last updated