DAYWORLD / Developer documentation

DeepSeek developer guide

From your first request to streaming and tool calls. Use the endpoint, key and model catalog assigned to your provisioned service.

Chat Completions · Responses · MessagesKeys and integrationModels and services

Before you start: endpoints and protocols

This guide calls DeepSeek through DAYWORLD, using the JD Cloud Flash model deepseek-flash in examples. Create a DAYWORLD API key, then confirm the models and protocols permitted for that key.

PurposeAddressConfiguration
OpenAI SDK Base URLhttps://api.example.com/v1For Chat Completions and Responses; the SDK appends the resource path.
Chat CompletionsPOST /v1/chat/completionsmodel + messages
ResponsesPOST /v1/responsesmodel + input
Anthropic SDK Base URLhttps://api.example.comThe SDK appends /v1/messages. Do not append /anthropic on DAYWORLD.
Available modelsGET /v1/modelsAuthenticate with the intended key and read data[].id.

API endpoints, routes and available log fields are confirmed when a service is provisioned. An entry route does not determine inference or all storage locations.

Prepare your key and environment

  1. Confirm the assigned API endpoint, model IDs and supported protocols when the service is provisioned. api.example.com is a placeholder.
  2. Protect the provisioned key and confirm its model scope, expiry and quota. Organization members use their own authorized scope.
  3. Set the variables below in a local terminal and replace the example endpoint and key with your assigned information.
Bash / zsh
export DAYWORLD_API_KEY="YOUR_DAYWORLD_API_KEY"
export DAYWORLD_BASE_URL="https://api.example.com/v1"
export DAYWORLD_MODEL="deepseek-flash"
PowerShell
$env:DAYWORLD_API_KEY = "YOUR_DAYWORLD_API_KEY"
$env:DAYWORLD_BASE_URL = "https://api.example.com/v1"
$env:DAYWORLD_MODEL = "deepseek-flash"

Replace YOUR_DAYWORLD_API_KEY locally. OpenAI-format requests use Authorization: Bearer. Messages also accepts x-api-key; send anthropic-version: 2023-06-01.

Model names and permissions

JD Cloud provides computing support with a high service level. Actual availability remains subject to current model supply and your service terms. Query the model IDs available to your key first:

GET /v1/models
curl --fail-with-body --silent --show-error \
  "$DAYWORLD_BASE_URL/models" \
  -H "Authorization: Bearer $DAYWORLD_API_KEY"
Request modelDescription
deepseek-flashJD Cloud Flash for personal accounts and enterprise identities using this name. The default in this guide.
DeepSeek-V4.1-Flash-1017-b-jdThe JD Cloud Flash name used by some enterprise catalogs. Use it when returned by your catalog.
deepseek-v4.1-flash-cyber-fqFrontierQuest DeepSeek Flash cybersecurity edition. Requires its own key permission; consult your catalog for prices and protocols.

The JD Flash aliases above are case-insensitive, but copy the catalog spelling for new integrations. The legacy deepseek-v4.1-flash alias resolves to JD Flash; it is not the cybersecurity model. An alias grants no additional permission and does not change your account prices.

A quote-only model with no active supply cannot be called. Seeing a price does not grant key access. GET /v1/models lists models available to that key, not every model on the platform.

Make your first request

Set the environment variables above first. This first request disables thinking and uses a small output limit to check authentication and model selection. Each actual model request is billed under your account rules.

Python: python -m pip install --upgrade openai. Node.js: npm install openai, save the sample as quickstart.mjs, then run node quickstart.mjs. In Windows PowerShell choose its own tab; Bash backslash continuation is not PowerShell syntax.

cURL · Bash
curl --fail-with-body --silent --show-error \
  "$DAYWORLD_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $DAYWORLD_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<JSON
{
  "model": "$DAYWORLD_MODEL",
  "messages": [{"role": "user", "content": "Explain an API in one short sentence."}],
  "thinking": {"type": "disabled"},
  "max_tokens": 256,
  "stream": false
}
JSON
PowerShell
$body = @{
  model = $env:DAYWORLD_MODEL
  messages = @(@{role="user"; content="Explain an API in one short sentence."})
  thinking = @{type="disabled"}
  max_tokens = 256
  stream = $false
} | ConvertTo-Json -Depth 8
$request = @{
  Method = "Post"
  Uri = "$env:DAYWORLD_BASE_URL/chat/completions"
  Headers = @{Authorization="Bearer $env:DAYWORLD_API_KEY"}
  ContentType = "application/json"
  Body = $body
}
$result = Invoke-RestMethod @request
$result.choices[0].message.content
Python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["DAYWORLD_API_KEY"],
    base_url=os.environ["DAYWORLD_BASE_URL"],
    timeout=90.0,
    max_retries=0,
)
result = client.chat.completions.create(
    model=os.environ["DAYWORLD_MODEL"],
    messages=[{"role": "user", "content": "Explain an API in one short sentence."}],
    max_tokens=256,
    extra_body={"thinking": {"type": "disabled"}},
)
print(result.choices[0].message.content)
print(result.usage)
Node.js
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.DAYWORLD_API_KEY,
  baseURL: process.env.DAYWORLD_BASE_URL,
  timeout: 90_000,
  maxRetries: 0,
});
const result = await client.chat.completions.create({
  model: process.env.DAYWORLD_MODEL,
  messages: [{role: "user", content: "Explain an API in one short sentence."}],
  thinking: {type: "disabled"},
  max_tokens: 256,
});
console.log(result.choices[0].message.content);
console.log(result.usage);
Request and response shapes
Example request body
{
  "model": "deepseek-flash",
  "messages": [
    {
      "role": "user",
      "content": "Reply with OK."
    }
  ],
  "thinking": {
    "type": "disabled"
  },
  "max_tokens": 256,
  "stream": false
}
Illustrative response; ID and usage are examples
{
  "id": "example_completion",
  "object": "chat.completion",
  "model": "deepseek-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "OK"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 1,
    "total_tokens": 13
  }
}

Text is in choices[0].message.content. Check finish_reason: stop is normal completion, length indicates a budget or context cutoff, and tool_calls requires tool handling. HTTP 200 alone does not prove that an answer is complete.

Streaming with SSE

Set stream: true and consume choices[].delta.content incrementally instead of waiting for a complete JSON document. Use --no-buffer in cURL and disable response buffering in your reverse proxy.

Python
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["DAYWORLD_API_KEY"],
                base_url=os.environ["DAYWORLD_BASE_URL"],
                timeout=90.0, max_retries=0)
with client.chat.completions.create(
    model=os.environ["DAYWORLD_MODEL"],
    messages=[{"role": "user", "content": "Give three short tips for writing readable code."}],
    stream=True,
    stream_options={"include_usage": True},
    max_tokens=512,
    extra_body={"thinking": {"type": "disabled"}},
) as stream:
    for chunk in stream:
        if chunk.usage is not None:
            print("\nUsage:", chunk.usage)
        if not chunk.choices:
            continue
        text = chunk.choices[0].delta.content
        if text:
            print(text, end="", flush=True)
print()
cURL · Bash
curl --no-buffer --fail-with-body --silent --show-error \
  "$DAYWORLD_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $DAYWORLD_API_KEY" \
  -H "Content-Type: application/json" \
  --data-binary @- <<JSON
{"model":"$DAYWORLD_MODEL","messages":[{"role":"user","content":"Reply with OK."}],"stream":true,"max_tokens":256,"thinking":{"type":"disabled"}}
JSON
  • Chat SSE uses data: frames and normally ends with data: [DONE]. TCP chunks are not event boundaries; parse SSE records separated by blank lines.
  • Handle empty choices, usage-only chunks and deltas with no text. Usage can arrive in a terminal or separate chunk depending on the provider.
  • During reasoning, delta.content can be empty while delta.reasoning_content carries reasoning text.
  • A disconnected stream does not prove the request was never processed. Do not blindly replay after receiving partial output; a replay is a separate call.

Thinking mode

DeepSeek controls thinking with thinking and selects effort with reasoning_effort. Pass extension fields through extra_body in the OpenAI Python SDK. Provider deployments can differ; these are current official parameter forms, not a claim that every historical model supports them.

ProtocolDisableEnable and effort
Chat Completionsthinking: {"type":"disabled"}thinking: {"type":"enabled"}
reasoning_effort: "low" | "high" | "max"
Responsesreasoning: {"effort":"none"}reasoning: {"effort":"low" | "high" | "max"}
Messagesthinking: {"type":"disabled"}thinking: {"type":"enabled"}
output_config: {"effort":"low" | "high" | "max"}
Python · thinking
# Reuse the OpenAI client from the quickstart.
result = client.chat.completions.create(
    model=os.environ["DAYWORLD_MODEL"],
    messages=[{"role": "user", "content": "Check whether 23 times 17 equals 391."}],
    reasoning_effort="high",
    extra_body={"thinking": {"type": "enabled"}},
    max_tokens=2048,
)
message = result.choices[0].message
print("Reasoning:", getattr(message, "reasoning_content", None))
print("Answer:", message.content)
print("Finish:", result.choices[0].finish_reason)

Read reasoning and final text separately. Sampling parameters such as temperature may not take effect in thinking mode. Do not assume official defaults, maximum context or maximum output budgets apply unchanged to every DAYWORLD provider.

Official reference: thinking mode

Multi-turn conversations

Chat Completions does not reconstruct history from a previous response ID. Send the required messages on each turn and append user → assistant → user in order. Bound history length and avoid accidentally appending a whole conversation twice.

Python · conversation
# Reuse the OpenAI client from the quickstart.
history = [{"role": "user", "content": "Suggest a short name for a library."}]
first = client.chat.completions.create(
    model=os.environ["DAYWORLD_MODEL"], messages=history,
    max_tokens=256, extra_body={"thinking": {"type": "disabled"}},
)
history.append({"role": "assistant", "content": first.choices[0].message.content})
history.append({"role": "user", "content": "Explain why that name fits."})
second = client.chat.completions.create(
    model=os.environ["DAYWORLD_MODEL"], messages=history,
    max_tokens=256, extra_body={"thinking": {"type": "disabled"}},
)
print(second.choices[0].message.content)

Complete a tool-call round trip

The model returns a function name and JSON arguments. Your application executes the function; DAYWORLD does not run your local code. The full loop is: declare tools → read tool_calls → validate and execute → return results with tool_call_id → request the final answer.

Complete Python example: query demo library opening hours
Python · tool round trip
import json
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["DAYWORLD_API_KEY"],
                base_url=os.environ["DAYWORLD_BASE_URL"],
                timeout=90.0, max_retries=0)
tools = [{
    "type": "function",
    "function": {
        "name": "lookup_opening_hours",
        "description": "Read the demo library opening hours for a weekday.",
        "parameters": {
            "type": "object",
            "properties": {"day": {"type": "string", "enum": ["monday", "tuesday"]}},
            "required": ["day"],
            "additionalProperties": False,
        },
    },
}]
messages = [{"role": "user", "content": "Use the opening-hours tool for monday."}]
demo_hours = {"monday": "09:00-18:00", "tuesday": "09:00-18:00"}
for _ in range(3):
    result = client.chat.completions.create(
        model=os.environ["DAYWORLD_MODEL"], messages=messages,
        tools=tools, max_tokens=512,
        extra_body={"thinking": {"type": "disabled"}},
    )
    message = result.choices[0].message
    if not message.tool_calls:
        print(message.content)
        break
    # Preserve the complete assistant message, including tool call IDs.
    messages.append(message.model_dump(exclude_none=True))
    for call in message.tool_calls:
        if call.function.name != "lookup_opening_hours":
            raise ValueError("Unexpected tool name")
        args = json.loads(call.function.arguments)
        if set(args) != {"day"} or args["day"] not in demo_hours:
            raise ValueError("Invalid tool arguments")
        output = {"day": args["day"], "hours": demo_hours[args["day"]]}
        messages.append({"role": "tool", "tool_call_id": call.id,
                         "content": json.dumps(output)})
else:
    raise RuntimeError("Tool round limit reached")

This example reads fixed demo data and limits the loop to three rounds. Handle every tool call and match each result to its original call ID. Do not execute arbitrary model-generated code or pass argument strings to eval. Keep the complete assistant-message preservation when enabling thinking.

Streaming tool calls: assemble before parsing
Python · collect tool fragments
# Collect all fragments before parsing or executing a tool call.
calls = {}
for chunk in stream:
    if not chunk.choices:
        continue
    for part in chunk.choices[0].delta.tool_calls or []:
        item = calls.setdefault(part.index, {"id": "", "name": "", "arguments": ""})
        if part.id:
            item["id"] = part.id
        if part.function:
            item["name"] += part.function.name or ""
            item["arguments"] += part.function.arguments or ""
# Validate the completed arguments and tool name against your allowlist next.

Streaming function.arguments contains string fragments, not a complete JSON object in every frame. Assemble by index, then parse and validate the completed call against your function allowlist.

Official reference: tool calls

JSON output

Request JSON with response_format: {"type":"json_object"} and explicitly mention JSON and the intended shape in the prompt. Check empty or truncated output before parsing, then validate application fields. Valid JSON is not the same as a valid business schema.

Python · JSON output
# Reuse the OpenAI client from the quickstart.
import json

result = client.chat.completions.create(
    model=os.environ["DAYWORLD_MODEL"],
    messages=[
        {"role": "system", "content": 'Return JSON only, shaped like {"title":"...","tags":["..."]}.'},
        {"role": "user", "content": "Summarize a guide about unit testing."},
    ],
    response_format={"type": "json_object"},
    max_tokens=512,
    extra_body={"thinking": {"type": "disabled"}},
)
choice = result.choices[0]
if choice.finish_reason != "stop" or not (choice.message.content or "").strip():
    raise ValueError("Incomplete or empty JSON response")
data = json.loads(choice.message.content)
if not isinstance(data, dict) or not isinstance(data.get("title"), str) or not isinstance(data.get("tags"), list):
    raise ValueError("Unexpected application schema")
print(data)

Official reference: JSON output

Responses protocol

The current JD Flash offering supports POST /v1/responses. Use input, max_output_tokens and reasoning.effort; changing only the URL of a Chat messages payload is insufficient.

Python
# Reuse the OpenAI client from the quickstart.
result = client.responses.create(
    model=os.environ["DAYWORLD_MODEL"],
    input=[{"role": "user", "content": "Explain an API in one short sentence."}],
    reasoning={"effort": "none"},
    max_output_tokens=256,
    store=False,
)
print(result.output_text)
HTTP JSON
{
  "model": "deepseek-flash",
  "input": [
    {
      "role": "user",
      "content": "Reply with OK."
    }
  ],
  "reasoning": {
    "effort": "none"
  },
  "max_output_tokens": 256,
  "store": false,
  "stream": false
}
Python · streaming
# Reuse the OpenAI client from the quickstart.
with client.responses.create(
    model=os.environ["DAYWORLD_MODEL"], input="Give three short study tips.",
    reasoning={"effort": "none"}, max_output_tokens=512,
    store=False, stream=True,
) as stream:
    for event in stream:
        if event.type == "response.output_text.delta":
            print(event.delta, end="", flush=True)
        elif event.type in {"response.failed", "response.incomplete"}:
            raise RuntimeError(f"Generation ended with {event.type}")
        elif event.type == "response.completed":
            print("\nUsage:", event.response.usage)

Official reference: Responses API

Anthropic Messages protocol

This protocol still calls DeepSeek. The full HTTP endpoint is https://api.example.com/v1/messages; set the Anthropic SDK base URL to https://api.example.com. Both samples use the same DAYWORLD key and model ID.

Python SDK: python -m pip install --upgrade anthropic. Response content is a list of blocks. Streaming uses events such as message_start, content_block_delta and message_stop, not Chat’s choices structure.

cURL · Bash
curl --fail-with-body --silent --show-error \
  "https://api.example.com/v1/messages" \
  -H "x-api-key: $DAYWORLD_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  --data-binary @- <<JSON
{"model":"$DAYWORLD_MODEL","max_tokens":256,"thinking":{"type":"disabled"},"messages":[{"role":"user","content":"Reply with OK."}]}
JSON
Python
import os
from anthropic import Anthropic

client = Anthropic(
    api_key=os.environ["DAYWORLD_API_KEY"],
    base_url="https://api.example.com",
    timeout=90.0, max_retries=0,
)
result = client.messages.create(
    model=os.environ["DAYWORLD_MODEL"],
    max_tokens=256,
    thinking={"type": "disabled"},
    messages=[{"role": "user", "content": "Reply with OK."}],
)
print("".join(block.text for block in result.content if block.type == "text"))

Official reference: Anthropic-compatible API

Usage, cache and prices

ProtocolCommon fieldsInterpretation
Chatusage.prompt_tokens
usage.completion_tokens
usage.total_tokens
Read final request usage; do not sum repeated cumulative values from stream chunks.
Chat cacheprompt_cache_hit_tokens
prompt_cache_miss_tokens
When supplied, these split cached and uncached input; do not add them again to total input.
Responsesusage.input_tokens
usage.output_tokens
Read the complete response or terminal event; cache and reasoning details depend on the actual response.
Messagesusage.input_tokens
usage.output_tokens
Cache read/write fields can be separate; interpret them under the Messages usage convention.

DeepSeek cache reuse is based on repeated input prefixes and is best-effort. Stable system instructions and unchanged context prefixes help reuse; output is still generated by the model rather than served as a fixed cached answer.

Actual CNY rates, permissions and billing rules follow the provisioned service’s price schedule and effective agreements. DeepSeek peak periods are 09:00–12:00 and 14:00–18:00 every day in Beijing time (UTC+8), with off-peak periods otherwise. This page publishes no fixed unit prices and this public website does not process billing.

Official reference: context cache

Errors and retries

Keep the HTTP status, response body and X-Oneapi-Request-Id response header. For a stream, also retain its final observed event and partial result. Give support the time, route hostname, model ID and request ID while redacting full keys and sensitive input.

StatusCheck firstAction
400JSON, required fields, protocol parameters and context length.Correct the request; do not repeatedly retry it unchanged.
401DAYWORLD key, authentication format, expiry and revocation.Fix authentication; keep the key out of URLs.
402 / 403The returned balance, whitelist, organization allocation or permission reason.Resolve the stated cause; a different model spelling grants no access.
404Endpoint path, duplicate /v1, model spelling and active supply.Check the catalog and protocol before changing endpoints.
429Returned message, rule, scope, limit, window_seconds and retry_after.Honor Retry-After and reduce concurrency/RPM. A zero allocation requires assignment; waiting does not create quota.
500 / 502 / 503 / 504Provider failure, unavailable channels, gateway errors or timeouts.Use bounded backoff before output has arrived; after partial output, decide explicitly whether to make another call.

Bound retries, use exponential backoff with jitter and honor Retry-After. SDKs can retry automatically; samples set max_retries=0 (Node.js: maxRetries: 0) so first-run debugging does not hide repeated calls. DeepSeek’s direct-service rate-limit policy does not replace DAYWORLD account or organization limits.

Quotas and feature boundaries

  • Organization shared balance, personal balance, member spending caps and key quota are different limits. A member cap does not create another independent cash balance. Check the organization page and bill for the actual funding source.
  • The three native protocols have different payloads and terminal SSE events. Current JD Flash is connected through Chat Completions, Responses and Messages. Use only catalog-confirmed protocols for the cybersecurity edition or historical models.
  • Official Files, search, Vision, FIM and Beta strict features are not automatically enabled by protocol compatibility. This guide does not offer examples for features not individually confirmed on DAYWORLD.
  • Do not invent -thinking or -high model suffixes. Use the parameters in this guide while retaining the model ID returned by your account catalog.

Request field reference

FieldTypeRequiredNotes
modelstringYesA model ID from the current key catalog.
messagesarrayYesAt least one message with role and applicable content; tool results also require tool_call_id.
streambooleanNoDefaults to false; true returns SSE.
max_tokensintegerNoA positive integer. The effective limit depends on deployment, context and reasoning budget.
thinkingobjectNotype is enabled or disabled; use extra_body in the Python SDK.
toolsarrayNoDeclares function tools; your application handles returned tool_calls.
PurposeChat CompletionsResponsesMessages
Modelmodelmodelmodel
Inputmessagesinputmessages
System instructionmessages[]: role=systeminstructionssystem
Output limitmax_tokensmax_output_tokensmax_tokens
Streamingstreamstreamstream
Function toolstools[].functiontools[]: type=functiontools[].input_schema
Final textchoices[0].message.contentoutput[].content[] / SDK output_textcontent[]: type=text

Start with a minimal request, then add thinking, tools or output formats one at a time so compatibility problems remain easy to isolate. This guide currently covers DeepSeek only.

Official references and DAYWORLD rules

Official sources explain native protocols. DAYWORLD endpoints, model IDs, key permissions, active supply and CNY prices are determined by your current DAYWORLD catalog and bills. Documentation reviewed: 2026-11-10.