NewKimi K3.1 Pro is now availableTry it now
GuidePublished 6 min read

DeepSeek V4.1 Flash Cyber API Guide: AppSec & Security Agents

Use the DeepSeek V4.1 Flash 1017 abliterated API (deepseek cyber) for authorized AppSec, pentesting, and security agents with 1M context, ZDR, and caching.

Inference.net

Model specification and endpoint reference

DeepSeek V4.1 Flash 1017 Cyber (deepseek-v4.1-flash-1017-cyber) is an abliterated security-research variant of DeepSeek V4.1 Flash hosted on Inference.net. It is designed for authorized application security (AppSec) code auditing, penetration testing, red-team exercises, CTF workflows, vulnerability triage, and SOC automation where standard safety filters frequently interrupt multi-turn security agents with false-positive refusals.

SpecificationValue
API Model IDdeepseek-v4.1-flash-1017-cyber
Global Base URLhttps://api.inference.net/v1
US-Only Base URLhttps://us.api.inference.net/v1
Catalog Pricing (Input / Output)$0.30 / $1.00 per 1M tokens
Cached Input Reads$0.007 per 1M tokens (automatic prefix caching)
Context Window1,000,000 tokens (1M full-repository context)
Rate Limits500 RPM Free-tier · 1,000 RPM Paid · custom enterprise tiers
Wire Endpoints/v1/chat/completions, /v1/responses, /v1/messages
Access PolicyTeam-scoped Privileged Model Access approval required
Data PrivacyZero Data Retention enabled by default · SOC 2 Type II

If your workload does not involve dual-use security artifacts or exploit analysis, standard DeepSeek V4.1 Flash ($0.103/$0.60 per 1M) shares the same 1M context window and $0.007/1M cached reads at lower uncached input cost and is immediately callable without privileged access approval. See DeepSeek V4.1 Flash Cyber vs DeepSeek V4.1 Flash for a full breakdown.

Quickstart with cURL (streaming + usage accounting)

Prerequisite: deepseek-v4.1-flash-1017-cyber is a privileged model and requires approved team-scoped Privileged Model Access before calling the API. Teams without approval receive HTTP 403 with error.type: "model_access_required".

Once your team is approved, set INFERENCE_API_KEY from your dashboard and send requests to https://us.api.inference.net/v1 when you want US-only serving infrastructure (or https://api.inference.net/v1 for global routing). Pass stream: true and stream_options: {"include_usage": true} so the final SSE chunk reports prompt_tokens, completion_tokens, and prompt_tokens_details.cached_tokens.

bash
export INFERENCE_API_KEY="inf_your_api_key_here"

curl -N https://us.api.inference.net/v1/chat/completions \
  -H "Authorization: Bearer $INFERENCE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash-1017-cyber",
    "stream": true,
    "stream_options": {"include_usage": true},
    "messages": [
      {
        "role": "system",
        "content": "You are an authorized AppSec code auditor. Report concrete sinks, reproduction conditions, and minimal patches."
      },
      {
        "role": "user",
        "content": "Review this Express route for SSRF and path traversal:\napp.get(\"/proxy\", async (req, res) => { const r = await fetch(req.query.url); res.send(await r.text()); });"
      }
    ]
  }'

OpenAI Python SDK: streaming and tool calling

Because Inference.net is drop-in OpenAI SDK compatible, existing security scripts only change base_url, api_key, and model. The example below demonstrates streaming output with usage accounting alongside structured tool calling for an authorized AppSec triage agent.

python
import json
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://us.api.inference.net/v1",
    api_key=os.environ["INFERENCE_API_KEY"],
)

TOOLS = [
    {
        "type": "function",
        "function": {
            "name": "record_finding",
            "description": "Log a verified vulnerability finding from an authorized security audit.",
            "parameters": {
                "type": "object",
                "properties": {
                    "cwe": {"type": "string", "description": "CWE identifier, e.g. CWE-918"},
                    "severity": {"type": "string", "enum": ["low", "medium", "high", "critical"]},
                    "file_path": {"type": "string"},
                    "sink_summary": {"type": "string"},
                    "remediation": {"type": "string"},
                },
                "required": ["cwe", "severity", "file_path", "sink_summary", "remediation"],
            },
        },
    }
]

STATIC_SYSTEM_PROMPT = """You are an authorized application security engineer auditing internal services.
Keep findings grounded in the provided code. Emit record_finding tool calls for confirmed vulnerabilities."""


def stream_audit(repo_snapshot: str, target_diff: str) -> None:
    stream = client.chat.completions.create(
        model="deepseek-v4.1-flash-1017-cyber",
        stream=True,
        stream_options={"include_usage": True},
        tools=TOOLS,
        messages=[
            {"role": "system", "content": STATIC_SYSTEM_PROMPT},
            # Static repository bundle stays identical across turns to hit $0.007/1M cached reads
            {"role": "user", "content": f"Repository context:\n{repo_snapshot}"},
            {"role": "user", "content": f"Audit this diff for authz, injection, and SSRF flaws:\n{target_diff}"},
        ],
    )

    tool_calls: dict[int, dict[str, str]] = {}
    for chunk in stream:
        if chunk.choices:
            delta = chunk.choices[0].delta
            if delta.content:
                print(delta.content, end="", flush=True)
            if delta.tool_calls:
                for tc in delta.tool_calls:
                    entry = tool_calls.setdefault(tc.index, {"name": "", "arguments": ""})
                    if tc.function and tc.function.name:
                        entry["name"] += tc.function.name
                    if tc.function and tc.function.arguments:
                        entry["arguments"] += tc.function.arguments
        if chunk.usage:
            cached = getattr(chunk.usage.prompt_tokens_details, "cached_tokens", 0) or 0
            print(
                f"\n[usage] prompt={chunk.usage.prompt_tokens} cached={cached} completion={chunk.usage.completion_tokens}"
            )

    for call in tool_calls.values():
        print("\n[tool_call]", call["name"], json.loads(call["arguments"]))

Wiring DeepSeek Cyber into security and coding agents

deepseek-v4.1-flash-1017-cyber works directly with OpenAI-compatible terminal and IDE agents as well as custom LangGraph, CrewAI, or raw-SDK AppSec loops.

OpenCode

Install @inference/fast and pin OpenCode directly to deepseek-v4.1-flash-1017-cyber (see the OpenCode integration guide for full options and rollback commands):

bash
npm install -g @inference/fast
fast login
fast opencode on --model deepseek-v4.1-flash-1017-cyber

If you need US-pinned routing in ~/.config/opencode/opencode.json, set the provider baseURL to https://us.api.inference.net/v1:

json
{
  "provider": {
    "inference-net": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://us.api.inference.net/v1",
        "apiKey": "{env:INFERENCE_API_KEY}"
      },
      "models": {
        "deepseek-v4.1-flash-1017-cyber": {
          "name": "DeepSeek V4.1 Flash 1017 Cyber"
        }
      }
    }
  },
  "model": "inference-net/deepseek-v4.1-flash-1017-cyber"
}

Cline (VS Code / JetBrains)

In Cline's API Provider settings:

  1. Select OpenAI Compatible.
  2. Set Base URL to https://us.api.inference.net/v1 (or https://api.inference.net/v1).
  3. Paste your Inference.net API key into API Key.
  4. Set Model ID to deepseek-v4.1-flash-1017-cyber.

Because Cline sends workspace file trees and tool schemas in the system prefix on every turn, keeping your custom instructions stable lets repeated workspace turns hit cached input reads automatically.

Custom AppSec and SOC triage agents

For automated pipelines (SAST false-positive filtering, PR security gates, alert enrichment, or authorized pentest assistants):

  • Separate static context from per-alert payloads. Load your service architecture notes, threat model, and tool schemas once at the front of messages, then append each individual SAST alert or log trace as the final user turn.
  • Disable thinking if you need temperature: 0 determinism. Like DeepSeek V4.1 Flash 1017, deepseek-v4.1-flash-1017-cyber thinks by default and samples at temperature 1.0 regardless of the caller's temperature value while thinking is enabled. For reproducible CI vulnerability classification with temperature: 0 and strict tool schemas, disable thinking with reasoning_effort: "none" (or reasoning: {"enabled": false}; see the reasoning guide).
  • Handle HTTP 403 and 429 cleanly. Check error.type == "model_access_required" at startup (see below) and use exponential backoff on 429 bursts beyond your tier's RPM ceiling (500 RPM Free-tier, 1,000 RPM Paid).

Maximizing $0.007/1M cached reads on 1M-token repositories

DeepSeek V4.1 Flash routes on Inference.net use automatic (implicit) prefix caching backed by prefix-aware sticky routing on our GPU workers.

  • Do not pass prompt_cache_key on DeepSeek routes — prefix matching is automatic on byte-identical token prefixes.
  • Freeze everything before the split point. System prompt, tool definitions (in deterministic key order), and sorted repository files must remain byte-for-byte identical across turns. Never inject timestamps, random request IDs, or per-turn counters into the system prompt.
  • Batch related questions against the same snapshot. If you audit a 250,000-token service across 20 targeted security checks (authz, SSRF, SQLi, deserialization, secrets, IAM):
    • Cold turn (turn 1): 250K uncached input tokens at $0.30/1M = $0.075.
    • Warm turns (turns 2–20): 19 × 250K = 4.75M cached input tokens at $0.007/1M = $0.03325 total — roughly 97.7% cheaper than re-sending uncached input ($1.425).

Plug your own repository token count, turn depth, and expected cache hit rate into the Prompt Cache Calculator to forecast monthly spend across models.

Authorized use, privileged access, and Zero Data Retention

Authorized security workflows and access checks

deepseek-v4.1-flash-1017-cyber is intended strictly for authorized cybersecurity work — internal AppSec auditing, scoped penetration tests, red-team engagements with written authorization, defensive SOC triage, and educational CTF environments.

deepseek-v4.1-flash-1017-cyber is a privileged model and requires team-scoped Privileged Model Access approval before your team can invoke it. Before running the examples above or deploying a pipeline, check your team's approval status in GET /v1/models (or review the Privileged Model Access docs):

curl
curl -s https://api.inference.net/v1/models \
  -H "Authorization: Bearer $INFERENCE_API_KEY" \
  | jq '.data[] | select(.id == "deepseek-v4.1-flash-1017-cyber") | {id, requires_approved_access, access_status}'

Approved requests propagate to the API within 45 seconds. Calling a gated model without approval returns HTTP 403 with error.type: "model_access_required" and a link to the team request page.

Zero Data Retention and US residency

Auditing proprietary repositories, zero-day patches, or active incident traces requires strict handling guarantees:

  • Default Zero Data Retention (ZDR): New Inference.net teams start with Zero Data Retention enabled by default — prompts, completions, tool schemas, custom metadata, and error bodies are purged after processing and never used for model training.
  • SOC 2 Type II: Independent attestation with encryption in transit and at rest.
  • US-only serving host: Point clients at https://us.api.inference.net/v1 to keep requests strictly on US-hosted GPU clusters.

Related reading & models

Back to all guides