Phoenix Computation SDK API Doc
  • Welcome
  • Quick Start
  • Reference
    • API Reference
      • Users
      • Job Operations
      • Job Queries
      • PhoenixLLM
      • PhoenixGenAI
      • Distributed AI
Powered by GitBook
On this page
  • Query a Task
  • Polling
  • Websocket Streaming
  • Base GenAI
  • SDXL GenAI
  • Flux GenAI
  • Text to Motion
  • Image to Motion
  • CogVideo
  • Pyramid
  1. Reference
  2. API Reference

PhoenixGenAI

Good to know: All GenAI interfaces require token as a request header parameter.

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

Name
Type
Description

token*

string

The token generated in the previous step

Query Parameters

Name
Type
Description

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'
package main

import (
	"github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)

func main() {
	tokenStr := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs"
	taskID := "40a5a249-xxxx-xxxx-9ede-0618df6e77e0"
	result, err := controllers.QueryTask(taskID, tokenStr)
	...
}

Websocket Streaming

Good to know: Generating motion may take a long time. It is recommended to use WSS to obtain task results.

WSS wss://www.phoenix.global/sdk/ws/watch/all

Headers

Name
Type
Description

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

Name
Type
Description

token*

string

The token generated in the previous step

Request Body

Name
Type
Description

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"
}'
package main

import (
	"github.com/PhoenixGlobal/Phoenix-Computation-SDK/common"
	"github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)

func main() {
	tokenStr := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs"
	reqJSON := common.ReqGenImg{
		UserToken:     tokenStr,
		Prompt:        "iron man skiing on steep slope, hd, high quality",
		NegativePromt: "FastNegativeV2, (low quality:1.3),(worst quality:1.3),(monochrome:0.8),(deformed:1.3),(malformed hands:1.4),(poorly drawn hands:1.4),(mutated fingers:1.4),(bad anatomy:1.3),(extra limbs:1.35),(poorly drawn face:1.4),(watermark:1.3),ugly,watermark,jpeg artifacts,error,text,username",
	}
	result, err := controllers.GenImg(reqJSON)
	...
}

SDXL GenAI

Generating an image by SDXL mode.

POST https://www.phoenix.global/sdk/computation/genAI/genImgSDXL

Headers

Name
Type
Description

token*

string

The token generated in the previous step

Request Body

Name
Type
Description

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"
}'
package main

import (
	"github.com/PhoenixGlobal/Phoenix-Computation-SDK/common"
	"github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)

func main() {
	tokenStr := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjIyMkBnbWFpbC5jb20iLCJleHAiOjE3Mjk1ODUzMDZ9.33a-TNCliMkXA8xbrMUh6mokzXVjlo1GLKQPC8bGdPk"
	reqJSON := common.ReqGenImgSDXL{
		UserToken:     tokenStr,
		Prompt:        "iron man skiing on steep slope, hd, high quality",
		NegativePromt: "FastNegativeV2, (low quality:1.3),(worst quality:1.3),(monochrome:0.8),(deformed:1.3),(malformed hands:1.4),(poorly drawn hands:1.4),(mutated fingers:1.4),(bad anatomy:1.3),(extra limbs:1.35),(poorly drawn face:1.4),(watermark:1.3),ugly,watermark,jpeg artifacts,error,text,username",
	}
	result, err := controllers.GenImgSDXL(reqJSON)
	...
}

Flux GenAI

Generating an image by Flux mode.

POST https://www.phoenix.global/sdk/computation/genAI/genImgFlux

Headers

Name
Type
Description

token*

string

The token generated in the previous step

Request Body

Name
Type
Description

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"
}'
package main

import (
	"github.com/PhoenixGlobal/Phoenix-Computation-SDK/common"
	"github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)

func main() {
	tokenStr := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs"
	reqJSON := common.ReqGenImgFlux{
		UserToken: tokenStr,
		Prompt:    "iron man skiing on steep slope, hd, high quality",
	}
	result, err := controllers.GenImgFlux(reqJSON)
	...
}

Text to Motion

Generating a gif from prompts.

Good to know: Generating motion may take a long time. It is recommended to use WSS to obtain task results.

POST https://www.phoenix.global/sdk/computation/genAI/txt2Motion

Headers

Name
Type
Description

token*

string

The token generated in the previous step

Request Body

Name
Type
Description

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"
}'
package main

import (
  "github.com/PhoenixGlobal/Phoenix-Computation-SDK/common"
  "github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)

func main() {
  tokenStr := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs"
  reqBody := common.ReqTxt2Motion{
    Prompt:        "a flying phoenix",
    NegativePromt: "FastNegativeV2, (low quality:1.3),(worst quality:1.3),(monochrome:0.8),(deformed:1.3),(malformed hands:1.4),(poorly drawn hands:1.4),(mutated fingers:1.4),(bad anatomy:1.3),(extra limbs:1.35),(poorly drawn face:1.4),(watermark:1.3),ugly,watermark,jpeg artifacts,error,text,username",
    UserToken:     tokenStr,
  }
  result, err := controllers.Txt2Motion(reqBody)
  ...
}

Image to Motion

Generating a gif from an image

POST https://genapi.phoenix.global/sdk/computation/genAI/img2Motion

Headers

Name
Type
Description

Token*

string

The token generated in the previous step

Request Body

Name
Type
Description

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/333@gmail.com/phoenix.jpg"
}'
package main

import (
	"github.com/PhoenixGlobal/Phoenix-Computation-SDK/common"
	"github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)

func main() {
	tokenStr := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjIyMkBnbWFpbC5jb20iLCJleHAiOjE3Mjk2Nzg4MTZ9.O_DTemJ5byY_bytXVhfrGWUvZqkH5QvI03OuKpNjces"
	reqBody := common.ReqImg2Motion{
		ImagePath: "https://phoenix.global/ai/files/LLM/333@gmail.com/phoenix.jpg",
		Prompt:    "a flying phoenix",
		UserToken: tokenStr,
	}
	result, err := controllers.Img2Motion(reqBody)
	...
}

CogVideo

Generating a gif by CogVideo mode

POST https://genapi.phoenix.global/sdk/computation/genAI/cogVideo

Headers

Name
Type
Description

Token*

string

The token generated in the previous step

Request Body

Name
Type
Description

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",
}'
package main

import (
	"github.com/PhoenixGlobal/Phoenix-Computation-SDK/common"
	"github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)

func main() {
	tokenStr := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs"
	reqBody := common.ReqCogVideo{
		UserToken: tokenStr,
		Prompt:    "a flying phoenix",
	}
	result, err := controllers.CogVideo(reqBody)
	...
}

Pyramid

Generating a gif by Pyramid mode

POST https://genapi.phoenix.global/sdk/computation/genAI/pyramid

Headers

Name
Type
Description

Token*

string

The token generated in the previous step

Request Body

Name
Type
Description

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",
}'
package main

import (
	"github.com/PhoenixGlobal/Phoenix-Computation-SDK/common"
	"github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)

func main() {
	tokenStr := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs"
	reqBody := common.ReqPyramid{
		UserToken: tokenStr,
		Prompt:    "a flying phoenix",
	}
	result, err := controllers.Pyramid(reqBody)
	...
}
PreviousPhoenixLLMNextDistributed AI

Last updated 7 months ago