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
  • Buy LLM Token
  • Query Token price
  • Default LLM
  • Coding LLM
  1. Reference
  2. API Reference

PhoenixLLM

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

Buy LLM Token

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

Headers

Name
Type
Description

token*

string

The token generated in the previous step

Request Body

Name
Type
Description

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/buyLLMToken' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs' \
--header 'Content-Type: application/json' \
--data '{
  "tokensNum": 1000,
  "jobName": "LLM job"
}'
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.ReqBuyLlmToken{
    UserToken: tokenStr,
    JobName:   "Buy llm token 31",
    TokensNum: 1000,
  }
  result, err := controllers.BuyLLMToken(reqJSON)
  ...
}

Query Token price

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

Querying the price of LLM token, priced in ccd

Headers

Name
Type
Description

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

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

func main() {
  tokenStr := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs"
  result, err := controllers.QueryLLMPrice(tokenStr)
  ...
}

Default LLM

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

Headers

Name
Type
Description

token*

string

The token generated in the previous step

Request Body

Name
Type
Description

prompt*

string

Prompt

max_new_tokens

int

The maximum number of tokens that can be consumed by this call

Response

{
    "code": 200,
    "msg": "success",
    "text": "Blockchain is a distributed digital ledger technology...",
    "tokens_balance": 1534425
}

The usage of curl and golang sdk is as follows:

curl --location 'https://www.phoenix.global/sdk/computation/LLM/callLLM3' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs' \
--header 'Content-Type: application/json' \
--data '{
    "prompt": "what is blockchain"
}'
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.ReqLLM3{
    UserToken: tokenStr,
    Prompt:    "what is blockchain",
  }
  result, err := controllers.CallLLM3(reqJSON)
  ...
}

Coding LLM

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

Headers

Name
Type
Description

token*

string

The token generated in the previous step

Request Body

Name
Type
Description

prompt*

string

Prompt

max_new_tokens

int

The maximum number of tokens that can be consumed by this call

Response

{
    "code": 200,
    "msg": "success",
    "text": "Certainly! Below is an example of a simple Solidity smart contract that creates a basic token...",
    "tokens_balance": 1534425
}

The usage of curl and golang sdk is as follows:

curl --location 'https://www.phoenix.global/sdk/computation/LLM/verticalLLM' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNzM4Mjh9.7Qy6jh5L1qvVVbOZYR3JrmWdothI2SCF-oGyC2BfZDs' \
--header 'Content-Type: application/json' \
--data '{
    "prompt": "Write a simple solidity contract"
}'
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.ReqLLM3{
    UserToken: tokenStr,
    Prompt:    "Write a simple solidity contract",
  }
  result, err := controllers.VerticalLLM(reqJSON)
  ...
}
PreviousJob QueriesNextPhoenixGenAI

Last updated 7 months ago