Text modelsAdvanced usersUpdated
POST/v1/chat/completions

API console

POST/v1/chat/completions
View keys

Requests use the API key you enter and follow standard API billing.

DeepSeek V4.1 Flash

Request ID deepseek-flash

Protocols

Authentication

Requests require an API key from API key management. For JSON requests, set Content-Type: application/json.

  • Authorization: Bearer YOUR_API_KEY
  • Anthropic Messages · x-api-key: YOUR_API_KEY

Request parameters

POST /v1/chat/completions

FieldTypeRequiredDescription
modelstringRequiredSet the model ID to deepseek-flash.
messagesobject[]RequiredSend messages in conversation order. Each message has a role and content.
messages[].contentstring / object[]ConditionalThe message body. Use plain text or an array of content blocks defined by the protocol.
messages[].content[]objectConditionalUse a content block with type: image_url for images. Accepted formats depend on the endpoint.
streambooleanOptionaltrue requests an SSE stream. false requests a JSON response. Available modes depend on the endpoint.
max_completion_tokensintegerConditionalCaps generated tokens, including reasoning tokens where applicable. Use on endpoints that accept this field.
max_tokensintegerConditionalCompatibility field for the output token limit. Choose this field or max_completion_tokens according to the endpoint.
temperaturenumberConditionalControls sampling randomness. Accepted values and whether the field takes effect depend on the model and endpoint.
top_pnumberConditionalLimits sampling candidates by cumulative probability. Use when the model and endpoint support it.
response_formatobjectConditionalFor structured output, use type: json_object, or use type: json_schema with json_schema when the endpoint supports schemas.
toolsobject[]ConditionalTool definitions available to the model. Tool types and parameter formats depend on the protocol and endpoint.
tool_choicestring / objectConditionalControls tool selection. Use a forced or named choice only when the selected endpoint supports it.

POST /v1/messages

FieldTypeRequiredDescription
modelstringRequiredSet the model ID to deepseek-flash.
messagesobject[]RequiredSend user and assistant messages in order. Put system instructions in the top-level system field.
messages[].contentstring / object[]RequiredThe message body. Use plain text or an array of content blocks defined by the protocol.
messages[].content[]objectConditionalUse a type: image content block and put image data in source. Accepted formats depend on the endpoint.
systemstring / object[]OptionalSystem instructions as text or an array of text blocks.
max_tokensintegerRequiredCaps output tokens. The accepted limit depends on the model and endpoint.
streambooleanOptionaltrue requests an SSE stream. false requests a JSON response. Available modes depend on the endpoint.
temperaturenumberConditionalControls sampling randomness. Accepted values and whether the field takes effect depend on the model and endpoint.
top_pnumberConditionalLimits sampling candidates by cumulative probability. Use when the model and endpoint support it.
toolsobject[]ConditionalTool definitions available to the model. Tool types and parameter formats depend on the protocol and endpoint.
tool_choiceobjectConditionalControls tool selection. Use a forced or named choice only when the selected endpoint supports it.

POST /v1/messages/count_tokens

FieldTypeRequiredDescription
modelstringRequiredSet the model ID to deepseek-flash.
messagesobject[]RequiredSend user and assistant messages in order. Put system instructions in the top-level system field.
messages[].contentstring / object[]RequiredThe message body. Use plain text or an array of content blocks defined by the protocol.
messages[].content[]objectConditionalUse a type: image content block and put image data in source. Accepted formats depend on the endpoint.
systemstring / object[]OptionalSystem instructions as text or an array of text blocks.
toolsobject[]ConditionalTool definitions to include in the input token count. Send the same tools as in the Messages request.

POST /v1/responses

FieldTypeRequiredDescription
modelstringRequiredSet the model ID to deepseek-flash.
inputstring / object[]RequiredInput text or an ordered array of input items. Message items use role and content.
input[].content[]objectConditionalUse a content block with type: input_image for images. Accepted formats depend on the endpoint.
instructionsstringOptionalInstructions describing the task and output requirements.
max_output_tokensintegerOptionalCaps output tokens. The accepted limit depends on the model and endpoint.
streambooleanOptionaltrue requests an SSE stream. false requests a JSON response. Available modes depend on the endpoint.
storebooleanConditionalWhere supported, false requests that the response not be retained for later retrieval.
text.formatobjectConditionalSet text.format for structured output, for example type: json_schema. Use only on endpoints that support the format.
temperaturenumberConditionalControls sampling randomness. Accepted values and whether the field takes effect depend on the model and endpoint.
top_pnumberConditionalLimits sampling candidates by cumulative probability. Use when the model and endpoint support it.
toolsobject[]ConditionalTool definitions available to the model. Tool types and parameter formats depend on the protocol and endpoint.
tool_choicestring / objectConditionalControls tool selection. Use a forced or named choice only when the selected endpoint supports it.

Request examples

Set your API key in the local ICODEEASY_API_KEY environment variable and choose an endpoint that accepts direct HTTP calls. For endpoints that require a specific client, follow that client’s setup guide.

Chat Completions

bash
curl -sS 'https://api.icodeeasy.cc/v1/chat/completions' \
  -H "Authorization: Bearer $ICODEEASY_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{
  "model": "deepseek-flash",
  "messages": [
    {
      "role": "user",
      "content": "Explain how a rainbow forms in one sentence."
    }
  ],
  "stream": false
}'

Anthropic Messages

bash
curl -sS 'https://api.icodeeasy.cc/v1/messages' \
  -H "x-api-key: $ICODEEASY_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'anthropic-version: 2023-06-01' \
  --data '{
  "model": "deepseek-flash",
  "max_tokens": 256,
  "messages": [
    {
      "role": "user",
      "content": "Explain how a rainbow forms in one sentence."
    }
  ]
}'

Count Tokens

bash
curl -sS 'https://api.icodeeasy.cc/v1/messages/count_tokens' \
  -H "x-api-key: $ICODEEASY_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'anthropic-version: 2023-06-01' \
  --data '{
  "model": "deepseek-flash",
  "messages": [
    {
      "role": "user",
      "content": "Explain how a rainbow forms in one sentence."
    }
  ]
}'

OpenAI Responses

bash
curl -N -sS 'https://api.icodeeasy.cc/v1/responses' \
  -H "Authorization: Bearer $ICODEEASY_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{
  "model": "deepseek-flash",
  "instructions": "You are a helpful assistant.",
  "input": [
    {
      "type": "message",
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "Explain how a rainbow forms in one sentence."
        }
      ]
    }
  ],
  "stream": true,
  "store": false
}'

Read the response

  • Chat Completions · Read text from choices[].message.content. In an SSE stream, incremental output appears in choices[].delta. JSON · SSE
  • Anthropic Messages · Read blocks of type text in content[]. In a stream, process SSE content block events in order. JSON · SSE
  • Count Tokens · Read the input token count from input_tokens.
  • OpenAI Responses · In a stream, append the delta fields of response.output_text.delta events and handle completion and failure events. SSE

Full integration guide

Capabilities and limits

  • streaming · Supported
  • tool_calling · Conditional — Depends on the compatible protocol and request format
  • image_input · Supported
  • video_input · Not supported

Compatibility aliases and retired redirects

  • deepseek-v4.1-flash → deepseek-flash (Alias)
  • deepseek-v4-flash, deepseek-v4-flash-vision-exp → deepseek-flash (Retired redirect)

Model Capability Catalog · View pricing