Create completion
curl --request POST \
--url https://api.maxapi.ai/v1/completions \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-3.5-turbo-instruct"
}
'import requests
url = "https://api.maxapi.ai/v1/completions"
payload = { "model": "gpt-3.5-turbo-instruct" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({model: 'gpt-3.5-turbo-instruct'})
};
fetch('https://api.maxapi.ai/v1/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.maxapi.ai/v1/completions"
payload := strings.NewReader("{\n \"model\": \"gpt-3.5-turbo-instruct\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.maxapi.ai/v1/completions")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-3.5-turbo-instruct\"\n}")
.asString();{
"id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7",
"object": "text_completion",
"created": 1589478378,
"model": "text-davinci-003",
"choices": [
{
"text": "\n\nThis is indeed a test",
"index": 0,
"logprobs": null,
"finish_reason": "length"
}
],
"usage": {
"prompt_tokens": 5,
"completion_tokens": 7,
"total_tokens": 12
}
}Create completion
Use this endpoint to call the provider-compatible create completion operation through MaxAPI.
POST
https://api.maxapi.ai
/
v1
/
completions
Create completion
curl --request POST \
--url https://api.maxapi.ai/v1/completions \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-3.5-turbo-instruct"
}
'import requests
url = "https://api.maxapi.ai/v1/completions"
payload = { "model": "gpt-3.5-turbo-instruct" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({model: 'gpt-3.5-turbo-instruct'})
};
fetch('https://api.maxapi.ai/v1/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.maxapi.ai/v1/completions"
payload := strings.NewReader("{\n \"model\": \"gpt-3.5-turbo-instruct\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.maxapi.ai/v1/completions")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-3.5-turbo-instruct\"\n}")
.asString();{
"id": "cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7",
"object": "text_completion",
"created": 1589478378,
"model": "text-davinci-003",
"choices": [
{
"text": "\n\nThis is indeed a test",
"index": 0,
"logprobs": null,
"finish_reason": "length"
}
],
"usage": {
"prompt_tokens": 5,
"completion_tokens": 7,
"total_tokens": 12
}
}Headers
Body
application/json
要使用的模型的 ID。您可以使用List models API 来查看所有可用模型,或查看我们的模型概述以了解它们的描述。
生成完成的提示,编码为字符串、字符串数组、标记数组或标记数组数组。 请注意,<|endoftext|> 是模型在训练期间看到的文档分隔符,因此如果未指定提示,模型将生成新文档的开头。
使用什么采样温度,介于 0 和 2 之间。较高的值(如 0.8)将使输出更加随机,而较低的值(如 0.2)将使输出更加集中和确定。 我们通常建议改变这个或top_p但不是两者。
一种替代温度采样的方法,称为核采样,其中模型考虑具有 top_p 概率质量的标记的结果。所以 0.1 意味着只考虑构成前 10% 概率质量的标记。 我们通常建议改变这个或temperature但不是两者。
为每个提示生成多少完成。 注意:因为这个参数会产生很多完成,它会很快消耗你的令牌配额。请谨慎使用并确保您对max_tokens和进行了合理的设置stop。
API 将停止生成更多令牌的最多 4 个序列。返回的文本将不包含停止序列。
Response
200 - application/json
Request succeeded.