Custom Service
Run ML models and microservices as Docker containers and expose them as tools in DeepFellow.
The Custom Service lets you run any containerized application — an ML model, a microservice, or any HTTP API — directly on DeepFellow Infra. Once installed, the service is accessible through the /custom/{prefix}/{path} endpoint and can be connected to an LLM as a tool.
Available Models
The following models are ready to install from the Custom Service panel in DeepFellow Infra Web Panel:
| Model ID | Description |
|---|---|
lemmatizer | Multilingual text lemmatization API. |
bentoml/example-summarization | Text summarization service built with BentoML. |
deepfellow-bge-m3 | High-performance multilingual text embeddings model for sparse vectors. |
deepfellow-finetune | LLM LoRA fine-tuning framework with an OpenAI-compatible fine-tuning job queue. |
doc_chunker | Converts many file types (PDF, XLSX, MP3, and others) into text chunks suitable for vector search. |
easyOCR | Optical character recognition service that extracts text from images and binary data. |
gliner | Named-entity-recognition API used for Knowledge Graph extraction. |
To install one of these models:
Open DeepFellow Infra Web Panel and go to Services.
Locate the custom service and click Install if it is not already installed.
Click custom → Models, then find the model you want.
Click Install next to the model.
Add Your Own Model
You can run any containerized ML model or microservice in the Custom Service. This section walks through a complete example using an Iris species classifier.
Requirements
- DeepFellow Infra installed and running
- Docker installed
- uv
1. Train the Model
Create and save a trained ML model as a .pkl file. The example uses scikit-learn:
from sklearn.datasets import load_iris
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
import joblib
iris = load_iris()
X, y = iris.data, iris.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
model = RandomForestClassifier(n_estimators=100, random_state=42)
model.fit(X_train, y_train)
joblib.dump(model, "iris_model.pkl")Run it with:
uv run python create_iris_model.py2. Create a Microservice
Wrap the model in a web API. The example uses FastAPI on port 8001:
from fastapi import FastAPI, HTTPException
import joblib
from pydantic import BaseModel
from typing import List
import numpy
app = FastAPI()
model = joblib.load("iris_model.pkl")
class InputData(BaseModel):
features: List[float]
@app.post("/predict")
def predict(data: InputData) -> dict[str, int]:
prediction: numpy.ndarray = model.predict([data.features])
return {"prediction": prediction.tolist()[0]}
@app.get("/health")
def health() -> dict[str, str]:
return {"status": "ok"}
@app.get("/test_model")
def test_model() -> dict[str, int]:
# A working model classifies this Iris setosa sample as class 0.
prediction = model.predict([[5.1, 3.5, 1.4, 0.2]]).tolist()[0]
if prediction != 0:
raise HTTPException(status_code=503, detail=f"Expected class 0, got {prediction}")
return {"prediction": prediction}The /health and /test_model routes let DeepFellow Infra check the model when you click Test in the Web Panel. For details, see Testing Custom Models.
3. Write a Dockerfile
Package the microservice in a Docker image:
FROM python:3.11-slim
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
WORKDIR /app
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev
COPY . .
EXPOSE 8001
CMD ["uv", "run", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8001"]4. Build the Docker Image
docker build -t iris-model .You are not limited to locally built images. In the Docker image field you can also enter an image tag from Docker Hub or GitHub Container Registry.
5. Install on DeepFellow Infra
Open DeepFellow Infra Web Panel and go to Services → custom → Install.
Click custom → Add custom model.
Fill in the form: Model ID iris-model, Docker image iris-model, Docker image port 8001.
Click Add, then Install.
Enter iris-model as the endpoint prefix when prompted.
Wait for the model to appear in the list with a green Installed label.
6. Verify
Send a request to the DeepFellow Infra endpoint:
curl -X POST 'http://DEEPFELLOW_INFRA_HOST/custom/iris-model/predict' \
-H 'Authorization: Bearer DF_INFRA_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"features": [5.1, 3.5, 1.4, 0.2]}'Expected response:
{"prediction": 0}To check the model from DeepFellow Infra Web Panel, click Test on its model card.
Use as a Tool
To expose this model to an LLM, add it as a custom-mcp tool. See Using Tools for the full schema and a complete example using this iris classifier.
Testing Custom Models
To check that an installed custom model works, click Test on its model card in DeepFellow Infra Web Panel. DeepFellow Infra sends GET requests to the following routes of the model, through its /custom/{prefix} endpoint and in this order:
| Route | Purpose | If the route returns 404 |
|---|---|---|
/health | Health check | DeepFellow Infra sends GET /healthz instead. |
/healthz | Health check under an alternative name | The model has no health check. |
/test_model | Self-test you define in your image (optional) | The model has no self-test. |
The test passes if at least one of these routes exists and every route that exists returns 200:
- If the health check returns a status other than
200or404, the test fails and DeepFellow Infra doesn't call/test_model. - If
/test_modelreturns a status other than200or404, the test fails. - If none of the routes exists, the test fails.
- If the model's container doesn't accept connections, for example because it's still starting, the test fails with
Model unreachable.
The test result shows the response of /test_model, or the response of the health check if the model has no self-test. If that response is empty, the result shows passed for /test_model or healthy for the health check.
Self-Test Route
A health check shows that the service runs. To check that the model itself returns correct results, add a GET /test_model route to your image, as in the Iris example. The route must meet the following requirements:
- Accept a
GETrequest without a body. - Return
200when the model works, and a status other than404, for example503, when it doesn't. DeepFellow Infra reads404as an image without a self-test, so a broken model that returns404passes the test on the health check alone. - Return a short text or JSON verdict of at most 64 KB, not media such as audio or images.
- Respond quickly. The whole test, all routes together, has a limit of 30 seconds.
- Change no data: no writes, deletes, or resets.
Like every route of a custom model, /test_model is reachable at /custom/{prefix}/test_model for anyone who holds a DeepFellow Infra API key. Keep the route cheap to call, and don't return secrets, environment variables, or internal paths in its response.
A passing test shows that the model responds. It doesn't show that the Docker image is safe to run. Install images only from sources you trust.
Edit and Duplicate
Open the ⋮ menu on an installed model's card and click Edit Settings to change its configuration: the endpoint prefix, the Docker image, environment variables, or any other install-time option. DeepFellow uninstalls the running model, applies the new settings, and reinstalls it automatically.
To move a model to the newest version of its Docker image without opening the form, click Update in the same menu. See Updating Models.
- The Model ID cannot be changed from the Edit dialog. To register the model under a different ID, use Duplicate instead.
- If the endpoint prefix you enter is already used by another installed model, DeepFellow rejects the edit before uninstalling anything.
- Saving an edit with no changes closes the dialog without uninstalling and reinstalling the model.
To create an independent copy of a model instead of changing the original, select Save as a new service in the Edit dialog before saving. DeepFellow installs the copy immediately, under the ID and prefix you provide, with the same settings as the original.
Proxy Timeout
Every custom-service install form, whether for a catalog model or a model you add yourself, includes a Seconds the proxy waits for a response from this service before timing out field. It controls how long the proxy waits for that specific service to respond before timing out the request.
Leave the field empty to use the model's own default proxy timeout, which the field description shows. A model without one uses the standard_proxy_timeout_seconds setting (600 seconds by default). Of the catalog models, doc_chunker declares its own default of 7200 seconds, since it answers only once a whole file is converted. Set the field to a higher value for a service with a long processing time, or to a lower value for a fast service, so a failure is detected sooner. The value you enter applies only to that one installation and doesn't change the global default used by other services.
We use cookies on our website. We use them to ensure proper functioning of the site and, if you agree, for purposes such as analytics, marketing, and targeting ads.