DeepSeek V4.1 Flash
DeepSeek V4.1 Flash is DeepSeek's fast, low-cost reasoning model for code,
agents and tool calls. FlyMy.AI serves its October 17 build (1017). It reads
text and images, calls your function tools, and you choose how hard it thinks
with reasoning_effort. Call it with the OpenAI SDK or with the native
FlyMy.AI API, on the same wallet as every other model.
| Endpoint id | flymyai/deepseek-v4_1-flash |
| Model page | https://app.flymy.ai/models/flymyai/deepseek-v4_1-flash |
OpenAI base_url | https://api.flymy.ai/api/v1/flymyai/deepseek-v4_1-flash/openai/v1 |
| Native route | POST https://api.flymy.ai/api/v1/flymyai/deepseek-v4_1-flash/predict |
OpenAI-compatible API
from openai import OpenAI
client = OpenAI(
base_url="https://api.flymy.ai/api/v1/flymyai/deepseek-v4_1-flash/openai/v1",
api_key="fly-***",
)
response = client.chat.completions.create(
model="deepseek-v4.1-flash",
messages=[
{"role": "system", "content": "Answer briefly."},
{"role": "user", "content": "Write a Python one-liner that reverses a string."},
],
reasoning_effort="low",
max_tokens=400,
)
print(response.choices[0].message.content)
print(response.usage)
The model is selected by the base_url; model is echoed back. The key is your
FlyMy.AI key as a Bearer token.
With stream=True, the answer arrives as one content chunk when the model has
finished, followed by a chunk with finish_reason, the usage chunk and
data: [DONE].
usage follows the OpenAI convention: completion_tokens includes the
reasoning tokens, itemized in completion_tokens_details.reasoning_tokens;
prompt_tokens_details.cached_tokens shows the part of the prompt read from
the cache, and usage.cost is the price of the call.
Function tools
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Current weather for a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"],
},
},
}]
messages = [{"role": "user", "content": "What's the weather in Paris right now?"}]
first = client.chat.completions.create(
model="deepseek-v4.1-flash", messages=messages, tools=tools
)
call = first.choices[0].message.tool_calls[0]
messages += [
first.choices[0].message,
{"role": "tool", "tool_call_id": call.id, "content": '{"temp_c": 14, "sky": "light rain"}'},
]
final = client.chat.completions.create(
model="deepseek-v4.1-flash", messages=messages, tools=tools
)
print(final.choices[0].message.content)
tool_choice takes auto, none, required or a named function. Send the
assistant message with its tool_calls back as it came, then one tool
message per call.
Priority tier
Set service_tier="priority" (or "nitro") for the fastest serving at the
priority price. Without it the call runs on the default tier. The response's
service_tier says which tier answered.
Native API
The native route takes form fields or a JSON body and answers with one Server-Sent Event carrying the result:
curl -X POST https://api.flymy.ai/api/v1/flymyai/deepseek-v4_1-flash/predict \
-H "X-API-KEY: fly-***" -H "Content-Type: application/json" \
-d '{"prompt": "Write a haiku about rain.", "reasoning_effort": "low"}'
output_data holds output (the answer), finish_reason, model,
service_tier, stream_details (input_tokens, output_tokens,
cached_tokens, reasoning_tokens), reasoning when the model shows it, and
charge_usd, the price of the call.
DeepSeek V4.1 Flash does not use /predict/stream/. For long jobs,
/predict/async/ works as for other models, except in private mode.
Parameters
| Parameter | Values |
|---|---|
prompt | One user message |
messages | Chat history in the Chat Completions format (a JSON array in form data); used instead of prompt. Text and image_url content parts |
system_prompt | Instructions for the whole chat, added unless messages already has a system message |
reasoning_effort | none (answers at once), minimal, low, medium (default) or high |
service_tier | default or priority (alias nitro) |
max_tokens | Most tokens to generate, reasoning included, 1 to 131,072 (max_completion_tokens works too) |
temperature | 0 to 2 |
top_p | 0 to 1 |
private_mode | true keeps the prompt and the answer out of FlyMyAI storage and logs |
The OpenAI-compatible route also accepts up to 128 function tools,
tool_choice and tool-result messages. response_format is rejected with
400 unsupported_parameter.
Repeated prompt content is read from the cache by itself and billed at the cached rate. Keep the system prompt and tool definitions first and unchanged across turns. A call can be served by a different host than the previous one, so the first turns of a chat may miss the cache.
Private mode
Send private_mode: true - extra_body={"private_mode": True} in the OpenAI
SDK, or a form or JSON field on the native route. FlyMy.AI then keeps neither
the prompt nor the answer: the request history shows the call, its token
counts and its price, without the text. Private mode works with synchronous
calls only; an async request with it is refused, because an async request is
replayed from storage.
The host that serves the call keeps its own retention policy.
From an AI assistant
An assistant connected to FlyMy.AI quotes DeepSeek V4.1 Flash with
get_pricing, which also returns its OpenAI base_url, and asks it with
run_model (endpoint_id: flymyai/deepseek-v4_1-flash, the same input as
/predict). The result is the answer as text, followed by its token counts and
charge_usd.
Use DeepSeek as your agent's brain
Choose DeepSeek V4.1 Flash 1017 in the agent model picker, or pass
model: "deepseek-v4.1-flash-1017" to create_agent or update_agent on the
Agents MCP. list_agent_models lists its reasoning levels: low, medium and
high. The agent can call tools and continue after context compression. Each
model call is debited from the agent owner's FlyMy balance as it completes; you
do not need a DeepSeek key.
Pricing
| Tier | Input | Cached input | Output |
|---|---|---|---|
| Default | $0.30 / 1M | $0.006 / 1M | $1.20 / 1M |
| Priority | $0.375 / 1M | $0.0075 / 1M | $1.50 / 1M |
Reasoning tokens are billed as output. The price of every call is in
charge_usd (native) or usage.cost (OpenAI-compatible) and in your
usage.
Errors
| What you see | Meaning |
|---|---|
422 on the OpenAI route | A parameter is out of range, service_tier is not default or priority, or messages is malformed; the message says which |
400 unsupported_parameter | response_format |
HTTP 200 with status_code: 400 from /predict/stream/ | Use /predict or the OpenAI-compatible route |
private mode does not support async requests | Send the private call synchronously |
403 Insufficient funds | Top up your balance |