curl --request POST \
--url https://api.nano-gpt.com/api/v1/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "minimax/minimax-m2.7",
"prompt": "<string>",
"billing_mode": "<string>",
"billingMode": "<string>",
"provider": "<string>",
"max_tokens": 2,
"temperature": 1,
"top_p": 1,
"stream": false,
"stop": "<string>",
"frequency_penalty": 0,
"presence_penalty": 0,
"repetition_penalty": 1,
"top_k": 123,
"top_a": 123,
"min_p": 0.5,
"tfs": 0.5,
"eta_cutoff": 123,
"epsilon_cutoff": 123,
"typical_p": 0.5,
"mirostat_tau": 123,
"mirostat_eta": 123,
"min_tokens": 0,
"stop_token_ids": [
123
],
"include_stop_str_in_output": false,
"ignore_eos": false,
"no_repeat_ngram_size": 1,
"custom_token_bans": [
123
],
"logit_bias": {},
"logprobs": true,
"prompt_logprobs": true,
"seed": 123
}
'import requests
url = "https://api.nano-gpt.com/api/v1/completions"
payload = {
"model": "minimax/minimax-m2.7",
"prompt": "<string>",
"billing_mode": "<string>",
"billingMode": "<string>",
"provider": "<string>",
"max_tokens": 2,
"temperature": 1,
"top_p": 1,
"stream": False,
"stop": "<string>",
"frequency_penalty": 0,
"presence_penalty": 0,
"repetition_penalty": 1,
"top_k": 123,
"top_a": 123,
"min_p": 0.5,
"tfs": 0.5,
"eta_cutoff": 123,
"epsilon_cutoff": 123,
"typical_p": 0.5,
"mirostat_tau": 123,
"mirostat_eta": 123,
"min_tokens": 0,
"stop_token_ids": [123],
"include_stop_str_in_output": False,
"ignore_eos": False,
"no_repeat_ngram_size": 1,
"custom_token_bans": [123],
"logit_bias": {},
"logprobs": True,
"prompt_logprobs": True,
"seed": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'minimax/minimax-m2.7',
prompt: '<string>',
billing_mode: '<string>',
billingMode: '<string>',
provider: '<string>',
max_tokens: 2,
temperature: 1,
top_p: 1,
stream: false,
stop: '<string>',
frequency_penalty: 0,
presence_penalty: 0,
repetition_penalty: 1,
top_k: 123,
top_a: 123,
min_p: 0.5,
tfs: 0.5,
eta_cutoff: 123,
epsilon_cutoff: 123,
typical_p: 0.5,
mirostat_tau: 123,
mirostat_eta: 123,
min_tokens: 0,
stop_token_ids: [123],
include_stop_str_in_output: false,
ignore_eos: false,
no_repeat_ngram_size: 1,
custom_token_bans: [123],
logit_bias: {},
logprobs: true,
prompt_logprobs: true,
seed: 123
})
};
fetch('https://api.nano-gpt.com/api/v1/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nano-gpt.com/api/v1/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'minimax/minimax-m2.7',
'prompt' => '<string>',
'billing_mode' => '<string>',
'billingMode' => '<string>',
'provider' => '<string>',
'max_tokens' => 2,
'temperature' => 1,
'top_p' => 1,
'stream' => false,
'stop' => '<string>',
'frequency_penalty' => 0,
'presence_penalty' => 0,
'repetition_penalty' => 1,
'top_k' => 123,
'top_a' => 123,
'min_p' => 0.5,
'tfs' => 0.5,
'eta_cutoff' => 123,
'epsilon_cutoff' => 123,
'typical_p' => 0.5,
'mirostat_tau' => 123,
'mirostat_eta' => 123,
'min_tokens' => 0,
'stop_token_ids' => [
123
],
'include_stop_str_in_output' => false,
'ignore_eos' => false,
'no_repeat_ngram_size' => 1,
'custom_token_bans' => [
123
],
'logit_bias' => [
],
'logprobs' => true,
'prompt_logprobs' => true,
'seed' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nano-gpt.com/api/v1/completions"
payload := strings.NewReader("{\n \"model\": \"minimax/minimax-m2.7\",\n \"prompt\": \"<string>\",\n \"billing_mode\": \"<string>\",\n \"billingMode\": \"<string>\",\n \"provider\": \"<string>\",\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"stop\": \"<string>\",\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"repetition_penalty\": 1,\n \"top_k\": 123,\n \"top_a\": 123,\n \"min_p\": 0.5,\n \"tfs\": 0.5,\n \"eta_cutoff\": 123,\n \"epsilon_cutoff\": 123,\n \"typical_p\": 0.5,\n \"mirostat_tau\": 123,\n \"mirostat_eta\": 123,\n \"min_tokens\": 0,\n \"stop_token_ids\": [\n 123\n ],\n \"include_stop_str_in_output\": false,\n \"ignore_eos\": false,\n \"no_repeat_ngram_size\": 1,\n \"custom_token_bans\": [\n 123\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"prompt_logprobs\": true,\n \"seed\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.nano-gpt.com/api/v1/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"minimax/minimax-m2.7\",\n \"prompt\": \"<string>\",\n \"billing_mode\": \"<string>\",\n \"billingMode\": \"<string>\",\n \"provider\": \"<string>\",\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"stop\": \"<string>\",\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"repetition_penalty\": 1,\n \"top_k\": 123,\n \"top_a\": 123,\n \"min_p\": 0.5,\n \"tfs\": 0.5,\n \"eta_cutoff\": 123,\n \"epsilon_cutoff\": 123,\n \"typical_p\": 0.5,\n \"mirostat_tau\": 123,\n \"mirostat_eta\": 123,\n \"min_tokens\": 0,\n \"stop_token_ids\": [\n 123\n ],\n \"include_stop_str_in_output\": false,\n \"ignore_eos\": false,\n \"no_repeat_ngram_size\": 1,\n \"custom_token_bans\": [\n 123\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"prompt_logprobs\": true,\n \"seed\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nano-gpt.com/api/v1/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"minimax/minimax-m2.7\",\n \"prompt\": \"<string>\",\n \"billing_mode\": \"<string>\",\n \"billingMode\": \"<string>\",\n \"provider\": \"<string>\",\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"stop\": \"<string>\",\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"repetition_penalty\": 1,\n \"top_k\": 123,\n \"top_a\": 123,\n \"min_p\": 0.5,\n \"tfs\": 0.5,\n \"eta_cutoff\": 123,\n \"epsilon_cutoff\": 123,\n \"typical_p\": 0.5,\n \"mirostat_tau\": 123,\n \"mirostat_eta\": 123,\n \"min_tokens\": 0,\n \"stop_token_ids\": [\n 123\n ],\n \"include_stop_str_in_output\": false,\n \"ignore_eos\": false,\n \"no_repeat_ngram_size\": 1,\n \"custom_token_bans\": [\n 123\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"prompt_logprobs\": true,\n \"seed\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"created": 123,
"model": "<string>",
"choices": [
{
"text": "<string>",
"index": 123,
"logprobs": {},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}{
"error": 123,
"message": "<string>"
}Completions
Creates a completion for the provided prompt. This endpoint is available on a best-effort basis for legacy compatibility, and performance may be less consistent than /v1/chat/completions because not all upstream providers support the legacy completions API.
curl --request POST \
--url https://api.nano-gpt.com/api/v1/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "minimax/minimax-m2.7",
"prompt": "<string>",
"billing_mode": "<string>",
"billingMode": "<string>",
"provider": "<string>",
"max_tokens": 2,
"temperature": 1,
"top_p": 1,
"stream": false,
"stop": "<string>",
"frequency_penalty": 0,
"presence_penalty": 0,
"repetition_penalty": 1,
"top_k": 123,
"top_a": 123,
"min_p": 0.5,
"tfs": 0.5,
"eta_cutoff": 123,
"epsilon_cutoff": 123,
"typical_p": 0.5,
"mirostat_tau": 123,
"mirostat_eta": 123,
"min_tokens": 0,
"stop_token_ids": [
123
],
"include_stop_str_in_output": false,
"ignore_eos": false,
"no_repeat_ngram_size": 1,
"custom_token_bans": [
123
],
"logit_bias": {},
"logprobs": true,
"prompt_logprobs": true,
"seed": 123
}
'import requests
url = "https://api.nano-gpt.com/api/v1/completions"
payload = {
"model": "minimax/minimax-m2.7",
"prompt": "<string>",
"billing_mode": "<string>",
"billingMode": "<string>",
"provider": "<string>",
"max_tokens": 2,
"temperature": 1,
"top_p": 1,
"stream": False,
"stop": "<string>",
"frequency_penalty": 0,
"presence_penalty": 0,
"repetition_penalty": 1,
"top_k": 123,
"top_a": 123,
"min_p": 0.5,
"tfs": 0.5,
"eta_cutoff": 123,
"epsilon_cutoff": 123,
"typical_p": 0.5,
"mirostat_tau": 123,
"mirostat_eta": 123,
"min_tokens": 0,
"stop_token_ids": [123],
"include_stop_str_in_output": False,
"ignore_eos": False,
"no_repeat_ngram_size": 1,
"custom_token_bans": [123],
"logit_bias": {},
"logprobs": True,
"prompt_logprobs": True,
"seed": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'minimax/minimax-m2.7',
prompt: '<string>',
billing_mode: '<string>',
billingMode: '<string>',
provider: '<string>',
max_tokens: 2,
temperature: 1,
top_p: 1,
stream: false,
stop: '<string>',
frequency_penalty: 0,
presence_penalty: 0,
repetition_penalty: 1,
top_k: 123,
top_a: 123,
min_p: 0.5,
tfs: 0.5,
eta_cutoff: 123,
epsilon_cutoff: 123,
typical_p: 0.5,
mirostat_tau: 123,
mirostat_eta: 123,
min_tokens: 0,
stop_token_ids: [123],
include_stop_str_in_output: false,
ignore_eos: false,
no_repeat_ngram_size: 1,
custom_token_bans: [123],
logit_bias: {},
logprobs: true,
prompt_logprobs: true,
seed: 123
})
};
fetch('https://api.nano-gpt.com/api/v1/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nano-gpt.com/api/v1/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'minimax/minimax-m2.7',
'prompt' => '<string>',
'billing_mode' => '<string>',
'billingMode' => '<string>',
'provider' => '<string>',
'max_tokens' => 2,
'temperature' => 1,
'top_p' => 1,
'stream' => false,
'stop' => '<string>',
'frequency_penalty' => 0,
'presence_penalty' => 0,
'repetition_penalty' => 1,
'top_k' => 123,
'top_a' => 123,
'min_p' => 0.5,
'tfs' => 0.5,
'eta_cutoff' => 123,
'epsilon_cutoff' => 123,
'typical_p' => 0.5,
'mirostat_tau' => 123,
'mirostat_eta' => 123,
'min_tokens' => 0,
'stop_token_ids' => [
123
],
'include_stop_str_in_output' => false,
'ignore_eos' => false,
'no_repeat_ngram_size' => 1,
'custom_token_bans' => [
123
],
'logit_bias' => [
],
'logprobs' => true,
'prompt_logprobs' => true,
'seed' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nano-gpt.com/api/v1/completions"
payload := strings.NewReader("{\n \"model\": \"minimax/minimax-m2.7\",\n \"prompt\": \"<string>\",\n \"billing_mode\": \"<string>\",\n \"billingMode\": \"<string>\",\n \"provider\": \"<string>\",\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"stop\": \"<string>\",\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"repetition_penalty\": 1,\n \"top_k\": 123,\n \"top_a\": 123,\n \"min_p\": 0.5,\n \"tfs\": 0.5,\n \"eta_cutoff\": 123,\n \"epsilon_cutoff\": 123,\n \"typical_p\": 0.5,\n \"mirostat_tau\": 123,\n \"mirostat_eta\": 123,\n \"min_tokens\": 0,\n \"stop_token_ids\": [\n 123\n ],\n \"include_stop_str_in_output\": false,\n \"ignore_eos\": false,\n \"no_repeat_ngram_size\": 1,\n \"custom_token_bans\": [\n 123\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"prompt_logprobs\": true,\n \"seed\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.nano-gpt.com/api/v1/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"minimax/minimax-m2.7\",\n \"prompt\": \"<string>\",\n \"billing_mode\": \"<string>\",\n \"billingMode\": \"<string>\",\n \"provider\": \"<string>\",\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"stop\": \"<string>\",\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"repetition_penalty\": 1,\n \"top_k\": 123,\n \"top_a\": 123,\n \"min_p\": 0.5,\n \"tfs\": 0.5,\n \"eta_cutoff\": 123,\n \"epsilon_cutoff\": 123,\n \"typical_p\": 0.5,\n \"mirostat_tau\": 123,\n \"mirostat_eta\": 123,\n \"min_tokens\": 0,\n \"stop_token_ids\": [\n 123\n ],\n \"include_stop_str_in_output\": false,\n \"ignore_eos\": false,\n \"no_repeat_ngram_size\": 1,\n \"custom_token_bans\": [\n 123\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"prompt_logprobs\": true,\n \"seed\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nano-gpt.com/api/v1/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"minimax/minimax-m2.7\",\n \"prompt\": \"<string>\",\n \"billing_mode\": \"<string>\",\n \"billingMode\": \"<string>\",\n \"provider\": \"<string>\",\n \"max_tokens\": 2,\n \"temperature\": 1,\n \"top_p\": 1,\n \"stream\": false,\n \"stop\": \"<string>\",\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"repetition_penalty\": 1,\n \"top_k\": 123,\n \"top_a\": 123,\n \"min_p\": 0.5,\n \"tfs\": 0.5,\n \"eta_cutoff\": 123,\n \"epsilon_cutoff\": 123,\n \"typical_p\": 0.5,\n \"mirostat_tau\": 123,\n \"mirostat_eta\": 123,\n \"min_tokens\": 0,\n \"stop_token_ids\": [\n 123\n ],\n \"include_stop_str_in_output\": false,\n \"ignore_eos\": false,\n \"no_repeat_ngram_size\": 1,\n \"custom_token_bans\": [\n 123\n ],\n \"logit_bias\": {},\n \"logprobs\": true,\n \"prompt_logprobs\": true,\n \"seed\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"created": 123,
"model": "<string>",
"choices": [
{
"text": "<string>",
"index": 123,
"logprobs": {},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}{
"error": 123,
"message": "<string>"
}POST /api/v1/completions is available on a best-effort basis for legacy OpenAI compatibility. Performance and behavior may be less consistent than POST /api/v1/chat/completions because not all upstream providers support the legacy completions API.POST /api/v1/completions supports the same model suffix parser for provider routing (:fast, :cheap, etc.) and :reasoning-exclude, but this endpoint remains best-effort legacy compatibility. Prefer Chat Completions for new integrations. See Model Suffixes.provider field accepts either the existing provider ID string or a structured routing object with fields such as order, only, ignore, sort, max_price, allow_fallbacks, and require_parameters. See Provider Selection > Provider Routing Object.Authorizations
Headers
Optional explicit provider override for supported open-source models (case-insensitive). Explicit provider selection is billed pay-as-you-go at the selected provider's price, including provider-selection markup; for subscription users it bypasses subscription coverage for that request.
Body
Parameters for text completion
The model to use for completion. The model value may include supported model suffixes, including web search (':online', ':online/'), memory (':memory', ':memory-'), reasoning visibility (':reasoning-exclude'), thinking variants where listed by the model catalog (':thinking'), and provider routing preferences for eligible models (':fast', ':cheap', ':caching', etc.).
"minimax/minimax-m2.7"
"zai-org/glm-5:fast"
"zai-org/glm-5:cheap"
"openai/gpt-6.1-sol:online/exa-instant"
"openai/gpt-6.1-sol:online/exa-deep-reasoning"
Optional provider override or structured provider routing controls for provider-selection-capable models. A string explicitly selects one provider. An object can set soft order, hard pins, exclusions, sort preference, price caps, fallback behavior, and parameter-capability requirements.
Penalizes tokens that already appear in the conversation, on most providers including the prompt. 1 turns it off and values above 1 discourage repetition. Values below 1 encourage repetition and can cause misspelled words and endless loops, especially with long prompts. Unlike frequency_penalty and presence_penalty, the neutral value is 1, not 0
0 <= x <= 2Response
Text completion response