Skip to content

Pixtral-12B

Deploy Pixtral-12B on a Spheron RTX 4090 (24GB) instance using vLLM. Pixtral-12B is Mistral AI's multimodal model built on Mistral-NeMo 12B, with a dedicated 400M visual encoder supporting variable-resolution image inputs.

Recommended hardware

ModelRecommended GPUInstance TypeNotes
Pixtral-12BRTX 4090 (24GB)Dedicated or SpotFits in 24GB VRAM

Manual setup

Use these steps to set up the server manually after SSH-ing into your instance. This works on any provider regardless of cloud-init support.

Step 1: Connect to your instance

ssh <user>@<ipAddress>

Replace <user> with the username shown in the instance details panel (e.g., ubuntu for Spheron AI instances) and <ipAddress> with your instance's public IP.

Step 2: Install vLLM

sudo apt-get update -y
sudo apt-get install -y python3-pip
pip install vllm

Step 3: Start the server

Run the server in the foreground to verify it works:

python3 -m vllm.entrypoints.openai.api_server \
  --model mistralai/Pixtral-12B-2409 \
  --port 8000 \
  --dtype bfloat16 \
  --tokenizer-mode mistral \
  --config-format mistral \
  --load-format mistral

Press Ctrl+C to stop.

Step 4: Run as a background service

To keep the server running after you close your SSH session, create a systemd service:

sudo tee /etc/systemd/system/vllm-pixtral.service > /dev/null << 'EOF'
[Unit]
Description=Pixtral-12B vLLM Inference Server
After=network.target
 
[Service]
Type=simple
ExecStart=/usr/bin/python3 -m vllm.entrypoints.openai.api_server \
  --model mistralai/Pixtral-12B-2409 \
  --port 8000 \
  --dtype bfloat16 \
  --tokenizer-mode mistral \
  --config-format mistral \
  --load-format mistral
Restart=on-failure
RestartSec=10
 
[Install]
WantedBy=multi-user.target
EOF
 
sudo systemctl daemon-reload
sudo systemctl enable vllm-pixtral
sudo systemctl start vllm-pixtral

Accessing the server

SSH tunnel

ssh -L 8000:localhost:8000 <user>@<ipAddress>

Usage example: image input

import base64
from openai import OpenAI
 
client = OpenAI(base_url="http://localhost:8000/v1", api_key="not-needed")
 
with open("image.jpg", "rb") as f:
    image_b64 = base64.b64encode(f.read()).decode()
 
response = client.chat.completions.create(
    model="mistralai/Pixtral-12B-2409",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image_b64}"}},
                {"type": "text", "text": "Describe the image in detail."},
            ],
        }
    ],
)
print(response.choices[0].message.content)

Check server logs

journalctl -u vllm-pixtral -f

Cloud-init startup script (optional)

If your provider supports cloud-init, you can paste this into the Startup Script field when deploying to automate the setup above.

#cloud-config
runcmd:
  - apt-get update -y
  - apt-get install -y python3-pip
  - pip install vllm
  - |
    cat > /etc/systemd/system/vllm-pixtral.service << 'EOF'
    [Unit]
    Description=Pixtral-12B vLLM Inference Server
    After=network.target
 
    [Service]
    Type=simple
    ExecStart=/usr/bin/python3 -m vllm.entrypoints.openai.api_server \
      --model mistralai/Pixtral-12B-2409 \
      --port 8000 \
      --dtype bfloat16 \
      --tokenizer-mode mistral \
      --config-format mistral \
      --load-format mistral
    Restart=on-failure
    RestartSec=10
 
    [Install]
    WantedBy=multi-user.target
    EOF
  - systemctl daemon-reload
  - systemctl enable vllm-pixtral
  - systemctl start vllm-pixtral

What's next