{
  "manifest_version": "1.0.0",
  "template": {
    "id": "e0f3fc66-efe8-4952-b229-1d90d9935135",
    "slug": "text-embeddings-inference-model-cache",
    "name": "Text Embeddings Inference + Model Cache",
    "description": "Hugging Face TEI embeddings API with API key auth and model cache",
    "url": "https://railway.com/deploy/text-embeddings-inference-model-cache",
    "upstream": {
      "image": "ghcr.io/huggingface/text-embeddings-inference:cpu-1.9.4"
    }
  },
  "services": [
    {
      "name": "Text Embeddings Inference",
      "source": {
        "image": "ghcr.io/huggingface/text-embeddings-inference:cpu-1.9.4"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "PORT",
      "service": "Text Embeddings Inference",
      "description": "Port the router listens on, read by the --port flag. Railway's healthcheck and edge proxy probe $PORT, so it must equal the public domain target port (3000). The image itself defaults to 80.",
      "secret": false,
      "strategy": "default",
      "default": "3000"
    },
    {
      "key": "API_KEY",
      "service": "Text Embeddings Inference",
      "description": "Bearer token required on every inference route (/embed, /v1/embeddings, /rerank, /info, ...). Send it as 'Authorization: Bearer <API_KEY>'. /health, /, /ping and /metrics stay public so Railway's healthcheck works. Clear this variable only if you also remove the public domain.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "HOSTNAME",
      "service": "Text Embeddings Inference",
      "description": "Bind address, read by the --hostname flag. '::' binds IPv6 dual-stack so the public domain AND other Railway services (tei.railway.internal:3000) both reach it. Must be an IP literal: a non-IP value makes the router log 'Invalid hostname' and fall back to IPv4-only 0.0.0.0, which breaks private networking.",
      "secret": false,
      "strategy": "default",
      "default": "::"
    },
    {
      "key": "MODEL_ID",
      "service": "Text Embeddings Inference",
      "description": "Hugging Face model to serve, read by the --model-id flag. BAAI/bge-small-en-v1.5 is 33M parameters, 384 dimensions, 512 max tokens, about 133 MB of weights. Any model tagged text-embeddings-inference on the Hub works (embedding, reranker or classifier). Larger models need more RAM; this image runs on CPU only.",
      "secret": false,
      "strategy": "default",
      "default": "BAAI/bge-small-en-v1.5"
    },
    {
      "key": "AUTO_TRUNCATE",
      "service": "Text Embeddings Inference",
      "description": "Optional. Truncate inputs longer than the model's max sequence length instead of returning 413. Set false to make oversized inputs an explicit error.",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "PAYLOAD_LIMIT",
      "service": "Text Embeddings Inference",
      "description": "Optional. Maximum request body size in bytes (2 MB). Raise it if you batch many long documents per call.",
      "secret": false,
      "strategy": "default",
      "default": "2000000"
    },
    {
      "key": "MAX_BATCH_TOKENS",
      "service": "Text Embeddings Inference",
      "description": "Optional. Total tokens the server packs into one inference batch. Higher is faster but raises peak memory; lower it to about 4096 if the service is memory constrained.",
      "secret": true,
      "strategy": "default",
      "default": "16384"
    },
    {
      "key": "RAYON_NUM_THREADS",
      "service": "Text Embeddings Inference",
      "description": "Optional. CPU threads used for inference. The image ships 8; match it to the vCPUs of your Railway plan to avoid oversubscription.",
      "secret": false,
      "strategy": "default",
      "default": "8"
    },
    {
      "key": "HUGGINGFACE_HUB_CACHE",
      "service": "Text Embeddings Inference",
      "description": "Hugging Face cache directory, read by the --huggingface-hub-cache flag. Must match the volume mount path (/data) so model weights survive redeploys instead of being downloaded again on every boot.",
      "secret": false,
      "strategy": "default",
      "default": "/data"
    },
    {
      "key": "MAX_CLIENT_BATCH_SIZE",
      "service": "Text Embeddings Inference",
      "description": "Optional. Maximum number of inputs one request may contain. Requests above this get 413.",
      "secret": false,
      "strategy": "default",
      "default": "32"
    },
    {
      "key": "MAX_CONCURRENT_REQUESTS",
      "service": "Text Embeddings Inference",
      "description": "Optional. Queue depth. Requests beyond this are rejected with 429 instead of queueing forever.",
      "secret": false,
      "strategy": "default",
      "default": "512"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "text-embeddings-inference-model-cache"
      }
    },
    "cli": "railway deploy --template text-embeddings-inference-model-cache",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "e0f3fc66-efe8-4952-b229-1d90d9935135",
            "serializedConfig": {
              "services": {
                "aaaf6b44-a678-4f71-9444-33ec02755299": {
                  "icon": "https://avatars.githubusercontent.com/u/25720743?v=4",
                  "name": "Text Embeddings Inference",
                  "build": {},
                  "deploy": {
                    "healthcheckPath": "/health",
                    "requiredMountPath": "/data",
                    "restartPolicyType": "ON_FAILURE",
                    "healthcheckTimeout": 600,
                    "restartPolicyMaxRetries": 5
                  },
                  "source": {
                    "image": "ghcr.io/huggingface/text-embeddings-inference:cpu-1.9.4"
                  },
                  "variables": {
                    "PORT": {
                      "description": "Port the router listens on, read by the --port flag. Railway's healthcheck and edge proxy probe $PORT, so it must equal the public domain target port (3000). The image itself defaults to 80.",
                      "defaultValue": "3000"
                    },
                    "API_KEY": {
                      "description": "Bearer token required on every inference route (/embed, /v1/embeddings, /rerank, /info, ...). Send it as 'Authorization: Bearer <API_KEY>'. /health, /, /ping and /metrics stay public so Railway's healthcheck works. Clear this variable only if you also remove the public domain.",
                      "defaultValue": "{{API_KEY}}"
                    },
                    "HOSTNAME": {
                      "description": "Bind address, read by the --hostname flag. '::' binds IPv6 dual-stack so the public domain AND other Railway services (tei.railway.internal:3000) both reach it. Must be an IP literal: a non-IP value makes the router log 'Invalid hostname' and fall back to IPv4-only 0.0.0.0, which breaks private networking.",
                      "defaultValue": "::"
                    },
                    "MODEL_ID": {
                      "description": "Hugging Face model to serve, read by the --model-id flag. BAAI/bge-small-en-v1.5 is 33M parameters, 384 dimensions, 512 max tokens, about 133 MB of weights. Any model tagged text-embeddings-inference on the Hub works (embedding, reranker or classifier). Larger models need more RAM; this image runs on CPU only.",
                      "defaultValue": "BAAI/bge-small-en-v1.5"
                    },
                    "AUTO_TRUNCATE": {
                      "isOptional": true,
                      "description": "Optional. Truncate inputs longer than the model's max sequence length instead of returning 413. Set false to make oversized inputs an explicit error.",
                      "defaultValue": "true"
                    },
                    "PAYLOAD_LIMIT": {
                      "isOptional": true,
                      "description": "Optional. Maximum request body size in bytes (2 MB). Raise it if you batch many long documents per call.",
                      "defaultValue": "2000000"
                    },
                    "MAX_BATCH_TOKENS": {
                      "isOptional": true,
                      "description": "Optional. Total tokens the server packs into one inference batch. Higher is faster but raises peak memory; lower it to about 4096 if the service is memory constrained.",
                      "defaultValue": "16384"
                    },
                    "RAYON_NUM_THREADS": {
                      "isOptional": true,
                      "description": "Optional. CPU threads used for inference. The image ships 8; match it to the vCPUs of your Railway plan to avoid oversubscription.",
                      "defaultValue": "8"
                    },
                    "HUGGINGFACE_HUB_CACHE": {
                      "description": "Hugging Face cache directory, read by the --huggingface-hub-cache flag. Must match the volume mount path (/data) so model weights survive redeploys instead of being downloaded again on every boot.",
                      "defaultValue": "/data"
                    },
                    "MAX_CLIENT_BATCH_SIZE": {
                      "isOptional": true,
                      "description": "Optional. Maximum number of inputs one request may contain. Requests above this get 413.",
                      "defaultValue": "32"
                    },
                    "MAX_CONCURRENT_REQUESTS": {
                      "isOptional": true,
                      "description": "Optional. Queue depth. Requests beyond this are rejected with 429 instead of queueing forever.",
                      "defaultValue": "512"
                    }
                  },
                  "networking": {
                    "tcpProxies": {},
                    "serviceDomains": {
                      "tei-dom": {
                        "port": 3000
                      }
                    }
                  },
                  "volumeMounts": {
                    "57771ff7-3805-4c0c-b8cd-4ed7156e1e53": {
                      "mountPath": "/data"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "Text Embeddings Inference",
      "method": "GET",
      "path": "/health",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 1,
    "needs_volume": true
  },
  "generated_at": "2026-09-21T04:14:46.774Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-21T02:32:08.955Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_6c5f2b5585f64b9cb6f8",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "healthcheck",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 27,
    "typical_build_seconds": 0,
    "typical_start_seconds": 10,
    "slowest_service": "Text Embeddings Inference"
  }
}
