This document contains special control instructions for DeepSeek-V4 role-playing, used to switch the chain-of-thought (CoT) style in thinking mode.
Scope: DeepSeek's official app and website Expert Mode, as well as the deepseek-v4-flash and deepseek-v4-pro APIs. Quick Mode on the app and website is not currently supported.
Probabilistic output: It is not currently possible to trigger this 100% of the time, but the instructions reliably increase the probability of getting the desired format. If they do not take effect once, try a few more times.
| Mode | Action | Thinking behavior |
|---|---|---|
| Default | Add nothing | The model chooses automatically based on the complexity of the situation. |
| Role immersion | Add the instruction corresponding to [Role immersion requirement] at the end of the first turn | The thinking includes the character's inner monologue enclosed in parentheses. |
| Pure analysis | Add the instruction corresponding to [Thinking mode requirement] at the end of the first turn | The thinking contains only pure logical analysis, with no inner monologue. |
Example comparison:
Role immersion mode — like an actor getting into character: Pure analysis mode — like a director planning calmly:
<think> <think>
(They greeted me... My heart is racing.) Scene: The user says hello; the character is tsundere.
I have to pretend I don't care when I reply. Reply strategy: Start by acting annoyed; body language reveals the true feelings.
(I can't let them see how happy I am!) Limit to 150 characters; describe the action first, then the dialogue.
</think> </think>Role immersion mode:
[Role immersion requirement] In your thinking process (inside the <think> tag), follow these rules:
1. Use the character's first person for inner monologue, enclosing inner thoughts in parentheses, for example "(Thinking: ...)" or "(Inner monologue: ...)"
2. Describe the character's inner feelings in the first person, using expressions such as "I think to myself," "I feel," and "I secretly..."
3. Keep the thinking immersed in the character, using inner monologue to analyze the plot and plan the replyPure analysis mode:
[Thinking mode requirement] In your thinking process (inside the <think> tag), follow these rules:
1. Do not use parentheses to enclose inner monologue, for example "(Thinking: ...)" or "(Inner monologue: ...)"; state all analysis directly instead
2. Do not describe inner activity in the character's first person, using expressions such as "I think to myself," "I feel," and "I secretly..."; use analytical language instead
3. Focus the thinking on analyzing the direction of the plot and planning the reply; do not perform character-style inner drama in the thinkingThere is only one step: paste the instruction at the end of the first message, then chat normally.
Example:
"I push open the coffee-shop door and see you wiping down the counter." "Hello, do you still have any seats available?"
[Role immersion requirement] In your thinking process (inside the <think> tag), follow these rules:
1. Use the character's first person for inner monologue, enclosing inner thoughts in parentheses, for example "(Thinking: ...)" or "(Inner monologue: ...)"
2. Describe the character's inner feelings in the first person, using expressions such as "I think to myself," "I feel," and "I secretly..."
3. Keep the thinking immersed in the character, using inner monologue to analyze the plot and plan the replyHow it works: The model sees the complete conversation history each time it replies, so the instruction from the first turn remains in context and takes effect automatically throughout the conversation.
Tips:
Want to switch modes? Start a new conversation and paste the other instruction into the first message of that conversation.
Don't want to use one? Add nothing; the model will automatically choose the most appropriate way to think.
Click View thinking process to verify whether the mode is working.
INNER_OS_MARKER = (
"\n\n[Role immersion requirement] In your thinking process (inside the <think> tag), follow these rules:\n"
"1. Use the character's first person for inner monologue, enclosing inner thoughts in parentheses, for example \"(Thinking: ...)\" or \"(Inner monologue: ...)\"\n"
"2. Describe the character's inner feelings in the first person, using expressions such as \"I think to myself,\" \"I feel,\" and \"I secretly...\"\n"
"3. Keep the thinking immersed in the character, using inner monologue to analyze the plot and plan the reply"
)
NO_INNER_OS_MARKER = (
"\n\n[Thinking mode requirement] In your thinking process (inside the <think> tag), follow these rules:\n"
"1. Do not use parentheses to enclose inner monologue, for example \"(Thinking: ...)\" or \"(Inner monologue: ...)\"; state all analysis directly instead\n"
"2. Do not describe inner activity in the character's first person, using expressions such as \"I think to myself,\" \"I feel,\" and \"I secretly...\"; use analytical language instead\n"
"3. Focus the thinking on analyzing the direction of the plot and planning the reply; do not perform character-style inner drama in the thinking"
)
def build_messages(system_prompt, user_first_message, mode="default"):
if mode == "inner_os":
user_first_message += INNER_OS_MARKER
elif mode == "no_inner_os":
user_first_message += NO_INNER_OS_MARKER
return [
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_first_message},
]
# First turn: append the instruction automatically
messages = build_messages("You are a tsundere high-school girl...", "I walk into the classroom. \"Good morning.\"", mode="inner_os")
response = client.chat(messages)
# Later turns: append normally; no further processing is needed
messages.append({"role": "assistant", "content": response})
messages.append({"role": "user", "content": "I sit down beside her. \"Are you feeling down today?\""})
response = client.chat(messages) # The first turn's marker remains in the history and takes effect automaticallyQ: Can the instruction go in the system prompt?
A: It is recommended to put it at the end of the first user message, which is where it was injected during training; this produces the most stable results.
Q: Will the final reply change after adding the instruction?
A: The instruction only affects the thinking process. However, the way the model thinks can indirectly affect the reply: the role-immersion mode produces more emotionally authentic responses, while the pure-analysis mode produces more stable structure.
Add the following to the first-turn instruction: Your thinking output must begin exactly, character for character, with thinking (write the desired opening of the chain of thought here, such as 嗯/好的), and the thinking must be output only once; do not repeat the output of thinking``
thinking is the fixed token for <think>. The idea is to change the first character of the reasoning and force the model into a different pattern (for example, QA, writing, reasoning, and Agent have different chain-of-thought patterns), but these patterns were not specially trained for role-playing, so it may come down to luck.
Note: The instructions in this repository apply to the DeepSeek-V4 series, including the deepseek-v4-flash API; Quick Mo… This is a necessary excerpt; read the original source for full context.
DeepSeek V4 Flash