A high-performance REST API for the nomic-ai/nomic-embed-text-v1.5 model. Features dynamic dimensionality and an auto-unload mechanism to conserve GPU memory.
These instructions assume you have uv installed (pip install uv).
-
Clone the repository:
git clone https://github.com/mishl-dev/text-embed-api cd text-embed-api -
Create a virtual environment and install dependencies:
uv sync
-
Run the server:
uv run main.py
The API is now running at
http://localhost:8000. Interactive documentation is available athttp://localhost:8000/schema.
Settings are managed in the .env file:
# Leave empty to disable authentication
API_KEY=your-secret-key
# Unload model after 3600s (1hr) of inactivity. Set to 0 to disable.
MODEL_IDLE_TIMEOUT_SECONDS=3600Use curl or any HTTP client to make a POST request to the /embed endpoint:
curl -X POST "http://localhost:8000/embed" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-secret-key" \
-d '{
"texts": ["Hello world!"],
"dimensionality": 256
}'This project is licensed under the MIT License. See the LICENSE file for details.