LLM Memory Calculator

This will estimate if a local LLM fits in your GPU VRAM and system RAM

MCP Server

The LLM Memory Calculator is also available as an MCP (Model Context Protocol) server. AI assistants and agents that speak MCP can call the calculator directly instead of using the web form.

Endpoint

The server is hosted on this site at the address below, using the streamable HTTP transport (stateless) and no authentication, just like the public API:

https://llmmemorycalculator.samayas.eu/mcp

Tools

MCP clients discover these tools automatically through the standard tools/list call. For a specific Hugging Face model, call get_model_config first and map its architecture fields into the calculate_memory request, then read the verdict and recommendedGpuLayers from the result.

calculate_memory

estimates whether a local LLM fits in GPU VRAM or system RAM for llama.cpp, vLLM, SGLang or MLX, with a per-component breakdown and an offload recommendation — the same computation as the calculator page. It takes a single optional request object; every field below can be omitted and falls back to its default (7B model, Q4_K_M quantization, 4096 context, 24 GB VRAM, 64 GB RAM, llama.cpp, full GPU offload), so calling the tool without arguments is valid.

Parameters

ParameterTypeDefaultDescription
Model
parameterCountBillionsnumber7Parameter count in billions, e.g. 7 for a 7B model.
weightQuantizationenumQ4_K_MWeight quantization. Allowed values: IQ1_S, IQ1_M, IQ2_XXS, IQ2_XS, IQ2_S, IQ2_M, IQ3_XXS, IQ3_XS, IQ3_S, IQ3_M, IQ4_XS, IQ4_NL, Q2_K, Q2_K_XL, Q3_K_S, Q3_K_M, Q3_K_XL, Q3_K_L, Q4_0, Q4_1, Q4_K_S, Q4_K_M, Q4_K_XL, Q5_0, Q5_1, Q5_K_S, Q5_K_M, Q5_K_XL, Q6_K, Q8_0, F16, BF16.
activeParameterCountBillionsnumber0Active parameter count in billions for MoE models. Defaults to 0, which uses the total count.
usesMlaLatentAttentionbooleanfalseTrue when the model uses multi-head latent attention, which makes the KV cache estimate overstated.
hiddenSizeinteger0Hidden size. Defaults to 0, which derives it from parameters and layers.
vocabSizeinteger0Vocabulary size. Defaults to 0, which skips the logits buffer.
Architecture
layersinteger32Number of transformer layers.
attentionLayersinteger32Number of full attention layers.
kvHeadsinteger8Number of KV cache heads (GQA).
headDimensioninteger128Head dimension.
slidingWindowTokensinteger0Sliding window attention window in tokens. 0 with swaLayers 0 disables the capped SWA cache.
swaLayersinteger0Number of sliding window attention layers. Defaults to 0, which disables the capped SWA cache.
Context and inference
contextTokensinteger4096Context window in tokens.
batchSizeinteger2048Evaluation batch size.
physicalBatchSizeinteger512Physical batch size. 0 uses the evaluation batch size.
kvQuantKenumF16K cache quantization. Allowed values: F32, F16, BF16, Q8_0, Q5_1, Q5_0, Q4_1, Q4_0, IQ4_NL.
kvQuantVenumF16V cache quantization. Allowed values: F32, F16, BF16, Q8_0, Q5_1, Q5_0, Q4_1, Q4_0, IQ4_NL.
parallelSequencesinteger1Number of parallel sequences; contextTokens stays the total context split across the sequences.
flashAttentionbooleanfalseTrue when flash attention halves the context contribution of the compute buffer.
Hardware and runtime
vramGbnumber24Available GPU VRAM in GB.
ramGbnumber64Available system RAM in GB.
gpuLayersPercentinteger100Percentage of layers offloaded to the GPU.
runtimeenumLlamaCppRuntime. Allowed values: LlamaCpp, Vllm, Sglang, Mlx.
memoryArchitectureenumDiscreteMemory architecture. Allowed values: Discrete, Unified (Apple silicon).
unifiedMemoryPercentnumber0Usable unified memory in percent. Defaults to 0, which uses the runtime preset default.

Response

The result carries every size in bytes and the advice derived from them; all properties are returned in camelCase:

FieldTypeDescription
weightsBytesintegerSize of the model weights in bytes.
kvCacheBytesintegerSize of the KV cache in bytes.
computeBufferBytesintegerSize of the runtime compute buffer in bytes.
logitsBufferBytesintegerSize of the vocabulary logits buffer in bytes.
overheadBytesintegerRuntime overhead in bytes.
gpuBytesintegerTotal bytes allocated on the GPU side.
systemBytesintegerTotal bytes allocated in system RAM.
vramBytesintegerAvailable VRAM in bytes.
fitsInVrambooleanTrue when the GPU total fits in VRAM.
fitsWithHeadroombooleanTrue when the GPU total fits with the recommended headroom.
headroomBytesintegerRemaining VRAM headroom in bytes.
verdictenumOverall memory-fit verdict. Allowed values: Fits, FitsTight, OffloadRequired, DoesNotFit.
recommendedGpuLayersintegerRecommended number of layers to offload to the GPU.
offloadFitsInRambooleanTrue when the CPU-offload fallback fits in system RAM.
maxContextTokensintegerMaximum context length in tokens at full GPU offload.
isUnifiedMemorybooleanTrue when the calculation ran against a unified memory pool.
usableVramBytesintegerGPU-usable memory pool in bytes, the physical VRAM times the usable fraction on unified memory.
usableMemoryFractionnumberUsable memory fraction applied to the physical pool.
componentsarray of objectsPer-component memory breakdown; each entry carries name, bytes and the human-readable formula that produced the size.
warningsarray of stringWarnings produced by the calculation.

get_model_config

fetches the architecture fields of a Hugging Face model (layers, attention layers, KV heads, head dimension, hidden size, vocabulary size, sliding window settings, parameter counts and available weight quantizations) from the model repository. The fetch is performed server side from huggingface.co, so the repository needs to be public and the call adds a small delay. It takes a single parameter:

Parameters

ParameterTypeDescription
urlstringHugging Face model repo URL or bare owner/repository id, e.g. https://huggingface.co/unsloth/Qwen3-8B-GGUF or unsloth/Qwen3-8B-GGUF.

Response

The result carries the architecture fields extracted from the model config; all properties are returned in camelCase:

FieldTypeDescription
layersintegerNumber of transformer layers.
attentionLayersintegerNumber of full attention layers.
kvHeadsintegerNumber of KV cache heads.
headDimensionintegerAttention head dimension.
hiddenSizeintegerHidden size.
vocabSizeintegerVocabulary size, 0 when not present in the config.
swaLayersintegerNumber of sliding window attention layers, 0 when not present in the config.
slidingWindowTokensintegerSliding window attention window in tokens, 0 when not present in the config.
estimatedActiveParameterCountBillionsnumberEstimated active parameter count in billions for MoE models, 0 when not estimated.
activeParameterCountBillionsnumberActive parameter count in billions for MoE models, 0 when not retrieved.
usesMlaLatentAttentionbooleanTrue when the config carries kv_lora_rank, marking a Multi-head Latent Attention model.
estimatedParameterCountBillionsnumberEstimated total parameter count in billions, 0 when not estimated.
availableWeightQuantizationsarray of enumAvailable weight quantizations, null when unknown (no filtering).
parameterCountBillionsnumberParameter count in billions, 0 when not retrieved.

Setup

Add the server to any MCP client configuration:

{
  "mcpServers": {
    "llm-memory-calculator": {
      "type": "http",
      "url": "https://llmmemorycalculator.samayas.eu/mcp"
    }
  }
}

Claude Code CLI

claude mcp add --transport http llm-memory-calculator https://llmmemorycalculator.samayas.eu/mcp

GitHub Copilot CLI

copilot mcp add llm-memory-calculator --url https://llmmemorycalculator.samayas.eu/mcp

Cursor CLI

Cursor has no documented CLI add command — save the configuration above as .cursor/mcp.json in the project, or ~/.cursor/mcp.json globally.

VS Code

Run the MCP: Add Server command from the Command Palette, or save the configuration below as .vscode/mcp.json in the workspace.

{
  "servers": {
    "llm-memory-calculator": {
      "type": "http",
      "url": "https://llmmemorycalculator.samayas.eu/mcp"
    }
  }
}

Claude Desktop

Open the Settings, add a custom connector under Connectors and paste the endpoint URL below.

https://llmmemorycalculator.samayas.eu/mcp

Try It

You can inspect the server without writing any configuration: run the MCP Inspector from npm and connect to the endpoint URL above with the Streamable HTTP transport. The Inspector lists both tools with their full JSON schemas and lets you call them interactively.

npx @modelcontextprotocol/inspector --transport http https://llmmemorycalculator.samayas.eu/mcp

The MCP endpoint is rate limited to 20 requests per minute per client.

Invalid tool input returns an MCP tool error (Input is incorrect or invalid). When the rate limit is exceeded, the endpoint responds with HTTP 429 and a Retry-After header.