|
| 1 | +# vLLM Remote Tokenizer Feature |
| 2 | + |
| 3 | +This feature enables model-aware remote tokenizer support for vLLM inference engines in AIBrix gateway. |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +Enable vLLM remote tokenizer with one command: |
| 8 | + |
| 9 | +```bash |
| 10 | +kubectl apply -k config/features/vllm-remote-tokenizer/ |
| 11 | +``` |
| 12 | + |
| 13 | +## Configuration |
| 14 | + |
| 15 | +The following environment variables are configured: |
| 16 | + |
| 17 | +| Variable | Default | Description | |
| 18 | +|----------|---------|-------------| |
| 19 | +| AIBRIX_ENABLE_VLLM_REMOTE_TOKENIZER | false | Enable remote tokenizer feature | |
| 20 | +| AIBRIX_VLLM_TOKENIZER_ENDPOINT_TEMPLATE | http://%s:8000 | URL template for vLLM endpoints | |
| 21 | +| AIBRIX_TOKENIZER_HEALTH_CHECK_PERIOD | 30s | Health check interval | |
| 22 | +| AIBRIX_TOKENIZER_TTL | 5m | Tokenizer cache TTL | |
| 23 | +| AIBRIX_MAX_TOKENIZERS_PER_POOL | 100 | Maximum tokenizers per pool | |
| 24 | +| AIBRIX_TOKENIZER_REQUEST_TIMEOUT | 10s | Request timeout | |
| 25 | + |
| 26 | +## Customization |
| 27 | + |
| 28 | +To use custom values, copy this directory and modify `gateway-plugins-env-patch.yaml`: |
| 29 | + |
| 30 | +```bash |
| 31 | +cp -r config/features/vllm-remote-tokenizer/ config/features/my-vllm-config/ |
| 32 | +# Edit config/features/my-vllm-config/gateway-plugins-env-patch.yaml |
| 33 | +kubectl apply -k config/features/my-vllm-config/ |
| 34 | +``` |
| 35 | + |
| 36 | +## Enable the Feature |
| 37 | + |
| 38 | +To enable vLLM remote tokenizer after installation: |
| 39 | + |
| 40 | +```bash |
| 41 | +kubectl set env deployment/gateway-plugins -n aibrix-system AIBRIX_ENABLE_VLLM_REMOTE_TOKENIZER=true |
| 42 | +``` |
| 43 | + |
| 44 | +Or use a custom Kustomization overlay with the environment variable set to `true`. |
| 45 | + |
| 46 | +## Disable |
| 47 | + |
| 48 | +To disable, set the environment variable to false: |
| 49 | + |
| 50 | +```bash |
| 51 | +kubectl set env deployment/gateway-plugins -n aibrix-system AIBRIX_ENABLE_VLLM_REMOTE_TOKENIZER=false |
| 52 | +``` |
| 53 | + |
| 54 | +## Verification |
| 55 | + |
| 56 | +Check if enabled: |
| 57 | + |
| 58 | +```bash |
| 59 | +kubectl get deployment gateway-plugins -n aibrix-system -o json | \ |
| 60 | + jq '.spec.template.spec.containers[0].env[] | select(.name | startswith("AIBRIX_ENABLE_VLLM"))' |
| 61 | +``` |
| 62 | + |
| 63 | +Check metrics: |
| 64 | + |
| 65 | +```bash |
| 66 | +kubectl port-forward -n aibrix-system svc/gateway-plugins 8080:8080 |
| 67 | +curl http://localhost:8080/metrics | grep aibrix_tokenizer_pool |
| 68 | +``` |
0 commit comments