Chat Completions
Request endpoint
Section titled “Request endpoint”POST https://wudiapi.com/v1/chat/completions
Use Bearer authentication. A minimal text request looks like this:
{ "model": "deepseek-v4.1-flash", "messages": [ {"role":"system","content":"Answer concisely and accurately."}, {"role":"user","content":"Explain HTTP 404."} ], "stream": false}Common parameters
Section titled “Common parameters”| Field | Purpose |
|---|---|
model |
Required exact model ID available to your key |
messages |
Required ordered conversation messages |
stream |
Enable SSE output when true |
temperature |
Optional sampling setting, where supported |
max_tokens |
Output limit used by some models |
max_completion_tokens |
Generation limit used by some models; may include reasoning tokens |
tools |
Optional function definitions for supporting models |
Do not add both output-limit parameters without checking the model. Start with the minimal request and remove unsupported parameters according to the actual error response.
Conversation history
Section titled “Conversation history”The client normally maintains history. Pass previous user and assistant messages back in order:
{ "model":"deepseek-v4.1-flash", "messages":[ {"role":"user","content":"What does HTTP 404 mean?"}, {"role":"assistant","content":"The requested resource was not found."}, {"role":"user","content":"Give one troubleshooting step."} ]}Longer histories generally increase the next request’s input tokens. Start a new conversation when comparing models so earlier identity statements and answers do not influence the test.
Read the response
Section titled “Read the response”Non-streaming text is usually at choices[0].message.content. Check finish_reason for completion, length limits or tool calls. A tool-call message may have no text content; do not treat that alone as a failure.
Inspect usage and the platform’s usage log. Token reporting, reasoning fields and cache categories can differ by model. See streaming, tool calls and billing before adding more complex workflows.
