curl --request POST \
--url https://api.deepshi.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "deepshi-3.0",
"messages": [
{
"role": "user",
"content": "Say hello in one sentence."
}
]
}
'import requests
url = "https://api.deepshi.ai/v1/chat/completions"
payload = {
"model": "deepshi-3.0",
"messages": [
{
"role": "user",
"content": "Say hello in one sentence."
}
]
}
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: 'deepshi-3.0',
messages: [{role: 'user', content: 'Say hello in one sentence.'}]
})
};
fetch('https://api.deepshi.ai/v1/chat/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.deepshi.ai/v1/chat/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' => 'deepshi-3.0',
'messages' => [
[
'role' => 'user',
'content' => 'Say hello in one sentence.'
]
]
]),
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.deepshi.ai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"deepshi-3.0\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Say hello in one sentence.\"\n }\n ]\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.deepshi.ai/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"deepshi-3.0\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Say hello in one sentence.\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deepshi.ai/v1/chat/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\": \"deepshi-3.0\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Say hello in one sentence.\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "chat.completion",
"created": 123,
"model": "gpt-4o",
"choices": [
{
"index": 123,
"finish_reason": "<string>",
"message": {
"role": "assistant",
"content": "<string>",
"refusal": "<string>",
"reasoning": "<string>",
"reasoning_details": [
{}
],
"tool_calls": [
{
"id": "<string>",
"type": "function",
"index": 123,
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
]
},
"logprobs": {}
}
],
"usage": {
"prompt_tokens": 123,
"prompt_tokens_details": {
"cached_tokens": 123,
"cached_read_tokens": 123,
"image_tokens": 123
},
"completion_tokens": 123,
"completion_tokens_details": {
"reasoning_tokens": 123,
"image_tokens": 123
},
"total_tokens": 123,
"cost": {
"total_cost": 0.000135
}
},
"system_fingerprint": "<string>"
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "invalid_request_error",
"code": "model_not_found",
"param": null
}
}{
"error": {
"message": "Incorrect API key provided.",
"type": "invalid_request_error",
"code": "invalid_api_key",
"param": null
}
}{
"error": {
"message": "You have insufficient credits to complete this request.",
"type": "insufficient_quota",
"code": "insufficient_quota",
"param": null
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "invalid_request_error",
"code": "model_not_found",
"param": null
}
}{
"error": {
"message": "Rate limit reached. Please retry after a short delay.",
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"param": null
}
}{
"error": {
"message": "The server had an error while processing your request. Please retry.",
"type": "api_error",
"code": null,
"param": null
}
}Create a chat completion
Generates a model response for the given conversation. Set stream: true to receive the response incrementally as Server-Sent Events.
curl --request POST \
--url https://api.deepshi.ai/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "deepshi-3.0",
"messages": [
{
"role": "user",
"content": "Say hello in one sentence."
}
]
}
'import requests
url = "https://api.deepshi.ai/v1/chat/completions"
payload = {
"model": "deepshi-3.0",
"messages": [
{
"role": "user",
"content": "Say hello in one sentence."
}
]
}
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: 'deepshi-3.0',
messages: [{role: 'user', content: 'Say hello in one sentence.'}]
})
};
fetch('https://api.deepshi.ai/v1/chat/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.deepshi.ai/v1/chat/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' => 'deepshi-3.0',
'messages' => [
[
'role' => 'user',
'content' => 'Say hello in one sentence.'
]
]
]),
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.deepshi.ai/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"deepshi-3.0\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Say hello in one sentence.\"\n }\n ]\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.deepshi.ai/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"deepshi-3.0\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Say hello in one sentence.\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deepshi.ai/v1/chat/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\": \"deepshi-3.0\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Say hello in one sentence.\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "chat.completion",
"created": 123,
"model": "gpt-4o",
"choices": [
{
"index": 123,
"finish_reason": "<string>",
"message": {
"role": "assistant",
"content": "<string>",
"refusal": "<string>",
"reasoning": "<string>",
"reasoning_details": [
{}
],
"tool_calls": [
{
"id": "<string>",
"type": "function",
"index": 123,
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
]
},
"logprobs": {}
}
],
"usage": {
"prompt_tokens": 123,
"prompt_tokens_details": {
"cached_tokens": 123,
"cached_read_tokens": 123,
"image_tokens": 123
},
"completion_tokens": 123,
"completion_tokens_details": {
"reasoning_tokens": 123,
"image_tokens": 123
},
"total_tokens": 123,
"cost": {
"total_cost": 0.000135
}
},
"system_fingerprint": "<string>"
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "invalid_request_error",
"code": "model_not_found",
"param": null
}
}{
"error": {
"message": "Incorrect API key provided.",
"type": "invalid_request_error",
"code": "invalid_api_key",
"param": null
}
}{
"error": {
"message": "You have insufficient credits to complete this request.",
"type": "insufficient_quota",
"code": "insufficient_quota",
"param": null
}
}{
"error": {
"message": "The model does not exist or you do not have access to it.",
"type": "invalid_request_error",
"code": "model_not_found",
"param": null
}
}{
"error": {
"message": "Rate limit reached. Please retry after a short delay.",
"type": "rate_limit_error",
"code": "rate_limit_exceeded",
"param": null
}
}{
"error": {
"message": "The server had an error while processing your request. Please retry.",
"type": "api_error",
"code": null,
"param": null
}
}Authorizations
Your Deepshi API key, sent as Authorization: Bearer <key>.
Body
Unsupported or model-specific fields are ignored rather than rejected.
The model id to use, e.g. deepshi-3.0 or gpt-4o. Use the bare id returned by GET /v1/models, not a provider-prefixed id.
"deepshi-3.0"
The conversation so far, oldest first.
Show child attributes
Show child attributes
Sampling temperature. Lower is more deterministic.
0 <= x <= 2Nucleus sampling cutoff. Use instead of temperature, not both.
0 <= x <= 1Maximum tokens to generate in the response.
Alias of max_tokens accepted for OpenAI compatibility.
Controls how much a reasoning model thinks: none turns reasoning off; low/medium/high set the effort. Omit to use the model's default.
"high"
Up to 4 sequences at which generation stops.
Stream tokens as Server-Sent Events.
Show child attributes
Show child attributes
Best-effort deterministic sampling seed.
Number of choices to generate.
-2 <= x <= 2-2 <= x <= 2Show child attributes
Show child attributes
0 <= x <= 20Set to { "type": "json_object" } to force valid JSON output, or { "type": "json_schema", "json_schema": { ... } } for a schema (model-dependent).
Function/tool definitions the model may call.
Show child attributes
Show child attributes
Controls tool use: "auto", "none", "required", or a specific tool.
none, auto, required An opaque identifier for your end user.
Whether Deepshi may prepend its own tuned system prompt alongside the specified system prompt. Defaults to true
Response
A chat completion. When stream: true, the response is instead an SSE stream of ChatCompletionChunk events terminated by data: [DONE].
Was this page helpful?