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:
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
| Parameter | Type | Default | Description |
|---|---|---|---|
| Model | |||
parameterCountBillions | number | 7 | Parameter count in billions, e.g. 7 for a 7B model. |
weightQuantization | enum | Q4_K_M | Weight 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. |
activeParameterCountBillions | number | 0 | Active parameter count in billions for MoE models. Defaults to 0, which uses the total count. |
usesMlaLatentAttention | boolean | false | True when the model uses multi-head latent attention, which makes the KV cache estimate overstated. |
hiddenSize | integer | 0 | Hidden size. Defaults to 0, which derives it from parameters and layers. |
vocabSize | integer | 0 | Vocabulary size. Defaults to 0, which skips the logits buffer. |
| Architecture | |||
layers | integer | 32 | Number of transformer layers. |
attentionLayers | integer | 32 | Number of full attention layers. |
kvHeads | integer | 8 | Number of KV cache heads (GQA). |
headDimension | integer | 128 | Head dimension. |
slidingWindowTokens | integer | 0 | Sliding window attention window in tokens. 0 with swaLayers 0 disables the capped SWA cache. |
swaLayers | integer | 0 | Number of sliding window attention layers. Defaults to 0, which disables the capped SWA cache. |
| Context and inference | |||
contextTokens | integer | 4096 | Context window in tokens. |
batchSize | integer | 2048 | Evaluation batch size. |
physicalBatchSize | integer | 512 | Physical batch size. 0 uses the evaluation batch size. |
kvQuantK | enum | F16 | K cache quantization. Allowed values: F32, F16, BF16, Q8_0, Q5_1, Q5_0, Q4_1, Q4_0, IQ4_NL. |
kvQuantV | enum | F16 | V cache quantization. Allowed values: F32, F16, BF16, Q8_0, Q5_1, Q5_0, Q4_1, Q4_0, IQ4_NL. |
parallelSequences | integer | 1 | Number of parallel sequences; contextTokens stays the total context split across the sequences. |
flashAttention | boolean | false | True when flash attention halves the context contribution of the compute buffer. |
| Hardware and runtime | |||
vramGb | number | 24 | Available GPU VRAM in GB. |
ramGb | number | 64 | Available system RAM in GB. |
gpuLayersPercent | integer | 100 | Percentage of layers offloaded to the GPU. |
runtime | enum | LlamaCpp | Runtime. Allowed values: LlamaCpp, Vllm, Sglang, Mlx. |
memoryArchitecture | enum | Discrete | Memory architecture. Allowed values: Discrete, Unified (Apple silicon). |
unifiedMemoryPercent | number | 0 | Usable 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:
| Field | Type | Description |
|---|---|---|
weightsBytes | integer | Size of the model weights in bytes. |
kvCacheBytes | integer | Size of the KV cache in bytes. |
computeBufferBytes | integer | Size of the runtime compute buffer in bytes. |
logitsBufferBytes | integer | Size of the vocabulary logits buffer in bytes. |
overheadBytes | integer | Runtime overhead in bytes. |
gpuBytes | integer | Total bytes allocated on the GPU side. |
systemBytes | integer | Total bytes allocated in system RAM. |
vramBytes | integer | Available VRAM in bytes. |
fitsInVram | boolean | True when the GPU total fits in VRAM. |
fitsWithHeadroom | boolean | True when the GPU total fits with the recommended headroom. |
headroomBytes | integer | Remaining VRAM headroom in bytes. |
verdict | enum | Overall memory-fit verdict. Allowed values: Fits, FitsTight, OffloadRequired, DoesNotFit. |
recommendedGpuLayers | integer | Recommended number of layers to offload to the GPU. |
offloadFitsInRam | boolean | True when the CPU-offload fallback fits in system RAM. |
maxContextTokens | integer | Maximum context length in tokens at full GPU offload. |
isUnifiedMemory | boolean | True when the calculation ran against a unified memory pool. |
usableVramBytes | integer | GPU-usable memory pool in bytes, the physical VRAM times the usable fraction on unified memory. |
usableMemoryFraction | number | Usable memory fraction applied to the physical pool. |
components | array of objects | Per-component memory breakdown; each entry carries name, bytes and the human-readable formula that produced the size. |
warnings | array of string | Warnings 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
| Parameter | Type | Description |
|---|---|---|
url | string | Hugging 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:
| Field | Type | Description |
|---|---|---|
layers | integer | Number of transformer layers. |
attentionLayers | integer | Number of full attention layers. |
kvHeads | integer | Number of KV cache heads. |
headDimension | integer | Attention head dimension. |
hiddenSize | integer | Hidden size. |
vocabSize | integer | Vocabulary size, 0 when not present in the config. |
swaLayers | integer | Number of sliding window attention layers, 0 when not present in the config. |
slidingWindowTokens | integer | Sliding window attention window in tokens, 0 when not present in the config. |
estimatedActiveParameterCountBillions | number | Estimated active parameter count in billions for MoE models, 0 when not estimated. |
activeParameterCountBillions | number | Active parameter count in billions for MoE models, 0 when not retrieved. |
usesMlaLatentAttention | boolean | True when the config carries kv_lora_rank, marking a Multi-head Latent Attention model. |
estimatedParameterCountBillions | number | Estimated total parameter count in billions, 0 when not estimated. |
availableWeightQuantizations | array of enum | Available weight quantizations, null when unknown (no filtering). |
parameterCountBillions | number | Parameter 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/mcpGitHub Copilot CLI
copilot mcp add llm-memory-calculator --url https://llmmemorycalculator.samayas.eu/mcpCursor 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/mcpTry 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/mcpThe 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.