# Code Llama 13B Instruct on MacBook Air M4 (32 GB)

**Tight fit.** Uses 87.1% of usable memory. Close other GPU-heavy apps or switch to an 8-bit KV cache.

- Runtime: Ollama, Q4_K_M, 16K context
- Memory: 20.9 GB of 24.0 GB usable (87%)
  - Weights: 7.3 GB (published file size, codellama:13b-code-q4_K_M)
  - KV cache: 12.5 GB (exact)
  - Overhead: 1.1 GB
- Speed: 10.0–13.6 tok/s for one request (calibrated)
- Largest context that fits: 16K

## Run it

```sh
ollama run codellama:13b-code-q4_K_M
```

Setup guide: https://llmsizing.com/guides/ollama

## Cost per 1M tokens at 500K tokens/day

| Path | $/1M tokens | Detail |
| --- | --- | --- |
| Local | $2.81 | $0.04 power only; $1,500 hardware over 36 months |
| Cloud GPU | $0.25 | 1x RTX 3090 (24 GB) on Vast.ai, $0.18/hr (provider API, 2026-11-30) |
| API | — | not on OpenRouter |

Assumes 75% input and 25% output tokens, one request at a time, $0.18/kWh, hardware written off over 36 months.

## Links

- [Check prices for MacBook Air M4 (32 GB) on Amazon](https://www.amazon.com/s?k=MacBook%20Air%20M4%2032GB)
- [Rent 1x RTX 3090 (24 GB) on Vast.ai](https://cloud.vast.ai/create/)
- [Open in the calculator](https://llmsizing.com/?m=codellama-13b&hw=macbook-air-m4-32gb&q=q4_k_m&ctx=16384)
- [Full page](https://llmsizing.com/models/codellama-13b/on/macbook-air-m4-32gb)

Source: [llmsizing.com](https://llmsizing.com/models/codellama-13b/on/macbook-air-m4-32gb), data synced 2026-11-30.
