PhoenixLLM

Good to know: All LLM interfaces need to use token as the request header.

Creating a LLM job

POST https://www.phoenix.global/sdk/computation/LLM/createLLMJob

Headers

NameTypeDescription

token*

string

The token generated in the previous step

Request Body

NameTypeDescription

tokensNum*

integer

The number of tokens to be purchased

jobName*

string

Job name

{
    "code": 200,
    "msg": "success",
    "jobID": "15336929879565052031766977071313450079096374296015479727460579121350576553341"
}

The usage of curl and golang sdk is as follows:

curl --location 'https://www.phoenix.global/sdk/computation/LLM/createLLMJob' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs' \
--header 'Content-Type: application/json' \
--data '{
  "tokensNum": 1000,
  "jobName": "LLM job"
}'

Querying LLM price

GET https://www.phoenix.global/sdk/computation/LLM/queryLLMPrice

Querying the price of LLM token, priced in ccd

Headers

NameTypeDescription

token*

string

The token generated in the previous step

{
  "code": 200,
  "data": {
    "price": "0.000007142857"
  },
  "msg": "success"
}

The usage of curl and golang sdk is as follows:

curl --location 'https://www.phoenix.global/sdk/computation/LLM/queryLLMPrice' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs'

Calling LLM

The usage of golang sdk is as follows:

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

func main() {
      	genTokenBody := common.ReqGenToken{
		Email:  "xxx@gmail.com",
		Passwd: "xxxxxxxxxxx",
	}
	genTokenResult, err := controllers.GenToken(genTokenBody)
	tokenMap := make(map[string]interface{})
	err = json.Unmarshal(genTokenResult, &tokenMap)
	token := tokenMap["token"].(string)
	reqBody := common.ReqLLM{
		Prompt:       "Funniest joke ever:",
		Temperature:  0.95,
		MaxNewTokens: 200,
		UserToken:    token,
	}
	result, err := controllers.CallLLM(reqBody)
	......
}