Skip to main content
POST
/
v1
/
chat
/
completions
Create a chat completion
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": [
    {
      "content": "<string>",
      "name": "<string>",
      "tool_call_id": "<string>",
      "tool_calls": [
        {
          "id": "<string>",
          "type": "function",
          "index": 123,
          "function": {
            "name": "<string>",
            "arguments": "<string>"
          }
        }
      ]
    }
  ],
  "temperature": 1,
  "top_p": 0.5,
  "max_tokens": 123,
  "max_completion_tokens": 123,
  "stop": "<string>",
  "stream": true,
  "stream_options": {
    "include_usage": true
  },
  "seed": 123,
  "n": 123,
  "frequency_penalty": 0,
  "presence_penalty": 0,
  "logit_bias": {},
  "logprobs": true,
  "top_logprobs": 10,
  "response_format": {},
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "<string>",
        "description": "<string>",
        "parameters": {},
        "strict": true
      }
    }
  ],
  "parallel_tool_calls": true,
  "user": "<string>"
}
'
{
  "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>"
}

Authorizations

Authorization
string
header
required

Your Deepshi API key, sent as Authorization: Bearer <key>.

Body

application/json

Unsupported or model-specific fields are ignored rather than rejected.

model
string
required

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.

Example:

"deepshi-3.0"

messages
object[]
required

The conversation so far, oldest first.

temperature
number

Sampling temperature. Lower is more deterministic.

Required range: 0 <= x <= 2
top_p
number

Nucleus sampling cutoff. Use instead of temperature, not both.

Required range: 0 <= x <= 1
max_tokens
integer

Maximum tokens to generate in the response.

max_completion_tokens
integer

Alias of max_tokens accepted for OpenAI compatibility.

stop

Up to 4 sequences at which generation stops.

stream
boolean

Stream tokens as Server-Sent Events.

stream_options
object
seed
integer

Best-effort deterministic sampling seed.

n
integer

Number of choices to generate.

frequency_penalty
number
Required range: -2 <= x <= 2
presence_penalty
number
Required range: -2 <= x <= 2
logit_bias
object
logprobs
boolean
top_logprobs
integer
Required range: 0 <= x <= 20
response_format
object

Set to { "type": "json_object" } to force valid JSON output, or { "type": "json_schema", "json_schema": { ... } } for a schema (model-dependent).

tools
object[]

Function/tool definitions the model may call.

tool_choice

Controls tool use: "auto", "none", "required", or a specific tool.

Available options:
none,
auto,
required
parallel_tool_calls
boolean
user
string

An opaque identifier for your end user.

Response

A chat completion. When stream: true, the response is instead an SSE stream of ChatCompletionChunk events terminated by data: [DONE].

id
string
object
string
Example:

"chat.completion"

created
integer<int64>
model
string

The model id you requested (the bare public id).

Example:

"gpt-4o"

choices
object[]
usage
object

Token usage and the billed cost for the request.

system_fingerprint
string