{"id":19258610,"url":"https://github.com/substratusai/stapi","last_synced_at":"2026-06-29T21:30:16.869Z","repository":{"id":204028380,"uuid":"710645997","full_name":"substratusai/stapi","owner":"substratusai","description":"Sentence Transformers API: An OpenAI compatible embedding API server","archived":false,"fork":false,"pushed_at":"2024-09-04T15:09:04.000Z","size":272,"stargazers_count":40,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-05T09:25:15.394Z","etag":null,"topics":["api","embeddings","openai-api","sentence-transformers","vector-database"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/substratusai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-27T06:20:08.000Z","updated_at":"2024-12-30T19:20:31.000Z","dependencies_parsed_at":"2023-10-28T06:20:42.509Z","dependency_job_id":"e059b8ba-5391-44ae-9c95-292228c9f502","html_url":"https://github.com/substratusai/stapi","commit_stats":null,"previous_names":["substratusai/sentence-transformers-api","substratusai/stapi"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substratusai%2Fstapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substratusai%2Fstapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substratusai%2Fstapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/substratusai%2Fstapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/substratusai","download_url":"https://codeload.github.com/substratusai/stapi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240356189,"owners_count":19788512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","embeddings","openai-api","sentence-transformers","vector-database"],"created_at":"2024-11-09T19:13:48.560Z","updated_at":"2026-06-29T21:30:16.840Z","avatar_url":"https://github.com/substratusai.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# STAPI: Sentence Transformers API\n\nOpenAI compatible embedding API that uses Sentence Transformer for embeddings\n\nContainer Image: `ghcr.io/substratusai/stapi`\n\nSupport the project by adding a star! ❤️  \nJoin us on Discord:  \n\u003ca href=\"https://discord.gg/JeXhcmjZVm\"\u003e\n\u003cimg alt=\"discord-invite\" src=\"https://dcbadge.vercel.app/api/server/JeXhcmjZVm?style=flat\"\u003e\n\u003c/a\u003e\n\n## Install\nThere are 2 options to install STAPI: Docker or local Python install.\n\n### Install (Docker)\nRun the API locally using Docker:\n```bash\ndocker run -p 8080:8080 -d ghcr.io/substratusai/stapi\n```\n\n### Install (Local python)\nInstall and run the API server locally using Python. Only supports python 3.9, 3.10 and 3.11.\n\nClone the repo:\n```bash\ngit clone https://github.com/substratusai/stapi\ncd stapi\n```\n\nInstall dependencies:\n```bash\npip3 install -r requirements.txt\n```\n\nRun the webserver:\n```bash\nuvicorn main:app --port 8080 --reload\n```\n\n## Usage\nAfter you've installed STAPI,\nyou can visit the API docs on [http://localhost:8080/docs](http://localhost:8080/docs)\n\nYou can also use CURL to get embeddings:\n```bash\ncurl http://localhost:8080/v1/embeddings \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"input\": \"Your text string goes here\",\n    \"model\": \"all-MiniLM-L6-v2\"\n  }'\n```\n\nEven the OpenAI Python client can be used to get embeddings:\n```python\nimport openai\nopenai.api_base = \"http://localhost:8080/v1\"\nopenai.api_key = \"this isn't used but openai client requires it\"\nmodel = \"all-MiniLM-L6-v2\"\nembedding = openai.Embedding.create(input=\"Some text\", model=model)[\"data\"][0][\"embedding\"]\nprint(embedding)\n```\n\n## Supported Models\nAny model that's supported by Sentence Transformers should also work as-is\nwith STAPI.\nHere is a list of [pre-trained models](https://www.sbert.net/docs/pretrained_models.html) available with Sentence Transformers.\n\nBy default the `all-MiniLM-L6-v2` model is used and preloaded on startup. You\ncan preload any supported model by setting the `MODEL` environment variable.\n\nFor example, if you want to preload the `multi-qa-MiniLM-L6-cos-v1`, you\ncould tweak the `docker run` command like this:\n```bash\ndocker run -e MODEL=multi-qa-MiniLM-L6-cos-v1  -p 8080:8080 -d \\\n  ghcr.io/substratusai/sentence-transformers-api\n```\n\nNote that STAPI will only serve the model that it is preloaded with. You\nshould create another instance of STAPI to serve another model. The `model`\nparameter as part of the request body is simply ignored.\n\n\n## Integrations\nIt's easy to utilize the embedding server with various other tools because\nthe API is compatible with the OpenAI Embedding API.\n\n### Weaviate\nYou can use the Weaviate text2vec-openai module and use the\nSTAPI OpenAI compatible endpoint.\n\nIn your Weaviate Schema\nuse the following module config, assuming STAPI endpoint\nis available at `http://stapi:8080`:\n```\n  \"vectorizer\": \"text2vec-openai\",\n  \"moduleConfig\": {\n    \"text2vec-openai\": {\n      \"model\": \"davinci\",\n      \"baseURL\": \"http://stapi:8080\"\n    }\n  }\n```\nFor the OpenAI API key you can use any key, it won't be checked.\n\nRead the [STAPI Weaviate Guide](https://github.com/substratusai/stapi/tree/main/weaviate) for more details.\n\n## Creators\nFeel free to contact any of us:\n* [Sam Stoelinga aka Samos123](https://www.linkedin.com/in/samstoelinga/)\n* [Nick Stogner](https://www.linkedin.com/in/nstogner/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubstratusai%2Fstapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubstratusai%2Fstapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubstratusai%2Fstapi/lists"}