StarMagicStarMagic
English
简体中文简繁體中文繁EnglishEN日本語日EspañolES한국어KO
Integration Guide
DeepSeek - 完整参数文档
StarMagicStarMagic
English
简体中文简繁體中文繁EnglishEN日本語日EspañolES한국어KO
TextDeepSeekDeepseek

DeepSeek - Complete API Reference

  • Call DeepSeek models using OpenAI SDK format
  • Synchronous processing mode, real-time response
  • Supports deepseek-chat (general conversation) and deepseek-reasoner (deep reasoning) models
  • Text Chat: Single or multi-turn contextual conversation
  • System Prompts: Customize AI role and behavior
  • Streaming: SSE streaming output support
  • Tool Calling: Function Calling support
<Note> **BaseURL**: The default BaseURL is `https://api.starmagic.ai`, which has better support for text models and long-lived connections. `https://api.starmagic.ai` is the primary endpoint for multimodal services and serves as a fallback address for text models. </Note>

Authorization

AuthorizationstringheaderRequired

##All APIs require Bearer Token authentication## **Get API Key:** Visit [API Key Management Page](https://starmagic.ai/app/api-keys) to get your API Key **Add to request header:** ``` Authorization: Bearer YOUR_API_KEY ```

Authorization: Bearer YOUR_API_KEY

Request body

application/json
modelenum<deepseek-chat | deepseek-reasoner>Required

Chat model name - `deepseek-chat`: General conversation model - `deepseek-reasoner`: Deep reasoning model, excels at math, coding and complex logical reasoning **Note**: `deepseek-reasoner` does not support `temperature`, `top_p`, `tools`, `tool_choice`, `response_format` parameters. Passing these will be rejected by upstream

"deepseek-chat"
messagesobject[]Required

Conversation message list, supports multi-turn conversation Different roles have different field structures, select the corresponding role to view

[
  null
]
thinkingobject

Thinking mode control (Beta) **Details**: - Controls the deep thinking feature of `deepseek-reasoner` model - When enabled, the model will perform deep reasoning before responding

{
  "type": "enabled"
}
frequency_penaltynumber

Frequency penalty parameter to reduce repetitive content **Details**: - Positive values penalize tokens based on their frequency in the generated text - Higher values make it less likely to repeat existing content - Default: 0 (no penalty)

0
max_tokensinteger

Maximum number of tokens to generate **Details**: - The model will stop generating when this limit is reached - If not set, the model decides the generation length

4096
presence_penaltynumber

Presence penalty parameter to encourage new topics **Details**: - Positive values penalize tokens based on whether they have appeared in the text - Higher values encourage discussing new topics - Default: 0 (no penalty)

0
response_formatobject

Specify response format **Details**: - Set to `{"type": "json_object"}` to enable JSON mode - In JSON mode, the model will output valid JSON content

{
  "type": "text"
}
stopobject

Stop sequences. The model will stop generating when encountering these strings **Details**: - Can be a single string or an array of strings - Maximum 16 stop sequences

streamboolean

Whether to stream the response - `true`: Stream via SSE (Server-Sent Events), returning content in real-time chunks - `false`: Wait for the complete response before returning

false
stream_optionsobject

Streaming response options Only effective when `stream=true`

{
  "include_usage": true
}
temperaturenumber

Sampling temperature, controls output randomness **Details**: - Lower values (e.g. 0.2): More deterministic, focused output - Higher values (e.g. 1.5): More random, creative output - Default: 1

1
top_pnumber

Nucleus Sampling parameter **Details**: - Controls sampling from tokens whose cumulative probability reaches the threshold - For example, 0.9 means sampling from tokens reaching 90% cumulative probability - Default: 1.0 (consider all tokens) **Tip**: Avoid adjusting both temperature and top_p simultaneously

1
toolsobject[]

Tool definition list for Function Calling **Details**: - Maximum 128 tool definitions - Each tool requires a name, description and parameter schema

[
  {
    "type": "function",
    "function": {
      "name": "string",
      "description": "string",
      "parameters": {},
      "strict": false
    }
  }
]
tool_choiceobject

Controls tool calling behavior **Options**: - `none`: Do not call any tools - `auto`: Model decides whether to call tools - `required`: Force the model to call one or more tools **Default**: `none` when no tools provided, `auto` when tools are provided

logprobsboolean

Whether to return token log probabilities **Details**: - When set to `true`, the response will include log probability information for each token

false
top_logprobsinteger

Return log probabilities of the top N most likely tokens **Details**: - Requires `logprobs` to be set to `true` - Range: `[0, 20]`

0

Response

application/json
成功

Response body

idstring

Unique identifier for the chat completion

"930c60df-bf64-41c9-a88e-3ec75f81e00e"
modelstring

Actual model name used

"deepseek-chat"
objectenum<chat.completion>

Response type

"chat.completion"
createdinteger

Creation timestamp

1770617860
choicesobject[]

List of chat completion choices

[
  {
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Hello! I'm DeepSeek, a powerful AI assistant. I excel at general conversation, code generation, mathematical reasoning and many other tasks.",
      "reasoning_content": "Let me analyze this problem...",
      "tool_calls": [
        {
          "id": null,
          "type": null,
          "function": null
        }
      ]
    },
    "finish_reason": "stop"
  }
]
usageobject

Token usage statistics

{
  "prompt_tokens": 16,
  "completion_tokens": 10,
  "total_tokens": 26,
  "prompt_cache_hit_tokens": 0,
  "prompt_cache_miss_tokens": 16
}
system_fingerprintstring

System fingerprint identifier

"fp_eaab8d114b_prod0820_fp8_kvcache"
POST/v1/chat/completions
curl --request POST \
  --url https://api.starmagic.ai/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "deepseek-chat",
  "messages": [
    {
      "role": "user",
      "content": "Tell me about yourself"
    }
  ]
}'
Response: 成功
{
  "id": "930c60df-bf64-41c9-a88e-3ec75f81e00e",
  "model": "deepseek-chat",
  "object": "chat.completion",
  "created": 1770617860,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": null,
        "content": null,
        "reasoning_content": null,
        "tool_calls": null
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 16,
    "completion_tokens": 10,
    "total_tokens": 26,
    "prompt_cache_hit_tokens": 0,
    "prompt_cache_miss_tokens": 16
  },
  "system_fingerprint": "fp_eaab8d114b_prod0820_fp8_kvcache"
}