速度測試模型基準評測租用報告硬體解碼計算器組織ProAPI文件提交
語言
Actual Computer — Every computer, one endpoint

速度測試

DeepSeek-V4.1-Flash

RTX PRO 6000 Blackwell Max-Q Workstation Edition 96GB ×4 · vllm · FP8

fraserprice社群PRO2026年9月11日

解碼

352tok/s

預填

8.7ktok/s

首個 token 延遲

310ms

總計

775tok/s

峰值 VRAM

—

上下文長度

512K

KV 深度

0

批次大小

1

功耗

—

驗證

未驗證 — 實驗性結果

已驗證的執行使用標準測試提示詞,並記錄足夠的資料以核對結果。

  • The run did not use one of the standard test prompts.

啟動命令

vllm serve deepseek-ai/DeepSeek-V4.1-Flash --tensor-parallel-size 4 --max-model-len 524288 --gpu-memory-utilization 0.97 --max-num-seqs 8 --moe-backend b12x --speculative-config '{"method":"dspark","num_speculative_tokens":5,"draft_sample_method":"probabilistic","rejection_sample_method":"block","moe_backend":"b12x"}'

Theoretical memory ceiling

The model doesn't appear to fit in this hardware's recorded memory.

模型

GPU
RTX PRO 6000 Blackwell Max-Q Workstation Edition
數量
4
VRAM
96 GB
OS
Pop!_OS 24.04 LTS

引擎

引擎
vllm
Build
llm/vllm-ds41:b12x
量化
FP8
後端
cuda
TP
4
GPU mem util
0.97
Max running seqs
8
Spec decode
已啟用

執行設定

上下文
524,288 個 token
深度
0 個 token
批次大小
1
提示詞 token
2703
預填 tok/s
8,712.1 tok/s
輸出 token
2048

推測解碼

方法
dspark
每步接受數
4.78 個 token
接受率
76%
草稿 token
2,145
已接受 token
1,622

已記錄的證據

提示詞雜湊(SHA-256)
5a6b7bc1cbbc…
提示詞樣本 · 2,000 chars
[LocalMaxxing cache-bust nonce: c46e2a9e970d0c761db15c1ac5900c73]
I have a FastAPI service that receives webhook events from a payment provider and stores them in Postgres with asyncpg. The current handler:

```python
@app.post("/webhooks/payments")
async def payments_webhook(request: Request) -> dict[str, str]:
    payload = await request.json()
    if payload["type"] == "invoice.paid":
        await pool.execute(
            "INSERT INTO invoices (id, amount) VALUES ($1, $2)",
            payload["data"]["id"], payload["data"]["amount"],
        )
    return {"status": "ok"}
```

Problems: the `X-Signature` header is never verified, retried deliveries insert the same invoice twice, and any exception returns a 500 so the provider retries forever.

Rewrite this as a proper module: verify the signature with HMAC-SHA256 over the raw body and reject stale timestamps, make inserts idempotent on the event id, dispatch event types through a registry instead of if-chains, and return 2xx for event types we don't handle. Use pydantic models, full type hints, and no bare except. Include the SQL for the idempotency table and a pytest test for the signature check, then list the failure modes you would alert on.

I have a FastAPI service that receives webhook events from a payment provider and stores them in Postgres with asyncpg. The current handler:

```python
@app.post("/webhooks/payments")
async def payments_webhook(request: Request) -> dict[str, str]:
    payload = await request.json()
    if payload["type"] == "invoice.paid":
        await pool.execute(
            "INSERT INTO invoices (id, amount) VALUES ($1, $2)",
            payload["data"]["id"], payload["data"]["amount"],
        )
    return {"status": "ok"}
```

Problems: the `X-Signature` header is never verified, retried deliveries insert the same invoice twice, and any exception returns a 500 so the provider retries forever.

Rewrite this as a proper module: verify the signature with HMAC-SHA256 over the raw bod
輸出樣本 · 4,000 chars
The user wants a proper webhook module. Let me write this out cleanly.

Key requirements:
1. HMAC-SHA256 signature verification over raw body
2. Reject stale timestamps
3. Idempotent inserts on event id
4. Registry-based dispatch
5. 2xx for unhandled event types
6. Pydantic models, full type hints, no bare except
7. SQL for idempotency table
8. Pytest test for signature check
9. List failure modes to alert on

Let me structure this as a module. I'll use a signature format like `t=timestamp,v1=signature` (Stripe-style) since that's common.

Let me write it out.

```python
# webhooks/payments.py
from __future__ import annotations

import hashlib
import hmac
import logging
import time
from typing import Any, Awaitable, Callable, Final

import asyncpg
from fastapi import APIRouter, Header, HTTPException, Request, status
from pydantic import BaseModel, Field, ValidationError

logger = logging.getLogger(__name__)

router = APIRouter()

SIGNATURE_TOLERANCE_SECONDS: Final[int] = 300
SIGNATURE_HEADER: Final[str] = "X-Signature"


class InvoicePaidData(BaseModel):
    id: str
    amount: int = Field(ge=0)


class WebhookEvent(BaseModel):
    id: str
    type: str
    created: int
    data: dict[str, Any]


class InvoicePaidEvent(WebhookEvent):
    type: str = "invoice.paid"
    data: InvoicePaidData


# --- signature verification ---

def _parse_signature_header(header: str) -> tuple[int, str]:
    parts: dict[str, str] = {}
    for item in header.split(","):
        if "=" not in item:
            raise ValueError(f"malformed signature segment: {item!r}")
        k, v = item.split("=", 1)
        parts[k.strip()] = v.strip()
    try:
        timestamp = int(parts["t"])
        signature = parts["v1"]
    except KeyError as exc:
        raise ValueError(f"missing signature field: {exc}") from exc
    return timestamp, signature


def verify_signature(
    *,
    raw_body: bytes,
    header: str,
    secret: bytes,
    now: int | None = None,
    tolerance_seconds: int = SIGNATURE_TOLERANCE_SECONDS,
) -> None:
    """Raise ValueError if the signature is invalid or stale."""
    timestamp, provided = _parse_signature_header(header)
    current = now if now is not None else int(time.time())
    if abs(current - timestamp) > tolerance_seconds:
        raise ValueError("signature timestamp outside tolerance")

    signed_payload = f"{timestamp}.".encode() + raw_body
    expected = hmac.new(secret, signed_payload, hashlib.sha256).hexdigest()
    if not hmac.compare_digest(expected, provided):
        raise ValueError("signature mismatch")


# --- idempotency ---

INSERT_EVENT_SQL = """
INSERT INTO webhook_events (event_id, event_type, received_at)
VALUES ($1, $2, now())
ON CONFLICT (event_id) DO NOTHING
RETURNING event_id
"""


async def claim_event(pool: asyncpg.Pool, event_id: str, event_type: str) -> bool:
    """Return True if this is the first time we've seen the event."""
    row = await pool.fetchrow(INSERT_EVENT_SQL, event_id, event_type)
    return row is not None


# --- dispatch registry ---

Handler = Callable[[asyncpg.Pool, WebhookEvent], Awaitable[None]]


async def handle_invoice_paid(pool: asyncpg.Pool, event: WebhookEvent) -> None:
    data = InvoicePaidData.model_validate(event.data)
    await pool.execute(
        """
        INSERT INTO invoices (id, amount)
        VALUES ($1, $2)
        ON CONFLICT (id) DO NOTHING
        """,
        data.id,
        data.amount,
    )


HANDLERS: dict[str, Handler] = {
    "invoice.paid": handle_invoice_paid,
}


# --- endpoint ---

@router.post("/webhooks/payments")
async def payments_webhook(
    request: Request,
    x_signature: str = Header(..., alias=SIGNATURE_HEADER),
) -> dict[str, str]:
    raw_body = await request.body()
    secret: bytes = request.app.state.webhook_secret
    pool: asyncpg.Pool = request.app.state.pool

    try:
        verify_signature(raw_body=raw_body, header=x_signature, secret=secret)
    except ValueError as exc:
        logger.warning("webhook signat

此模型在此硬體上的更多執行