TEI
Hugging Face Text Embeddings Inference server: embed text, rerank candidates, and tokenize input through the TEI HTTP API.
How to call it
Prefer scripts/tei-api.sh for common TEI requests. It resolves TEI_URL and
optional TEI_AUTH_HEADER from the plugin-generated config first, then the
environment or legacy ~/.lab/.env, and exposes health, info, embed,
embed-batch, sparse, rerank, tokenize, and openai-embed.
Configure tei_url and optional sensitive tei_auth_header in Claude plugin
settings or Gemini extension settings. The hook writes
${XDG_CONFIG_HOME:-~/.config}/lab-tei/config.env with mode 600.
Use the TEI base URL from plugin config, the runtime environment, or legacy lab configuration:
source "${XDG_CONFIG_HOME:-$HOME/.config}/lab-tei/config.env" 2>/dev/null || true
TEI_URL=${TEI_URL:-$(grep -E '^TEI_URL=' ~/.lab/.env 2>/dev/null | cut -d= -f2-)}
test -n "$TEI_URL" || echo "TEI_URL is not configured"
TEI often runs unauthenticated on trusted networks. If the deployment is behind
auth, set tei_auth_header to the full header, for example
Authorization: Bearer <token>. Do not put real tokens in examples or committed
files.
Common operations
| Intent | Request |
|---|---|
| Health | curl -sS "$TEI_URL/health" -w '\nHTTP %{http_code}\n' |
| Loaded model / runtime info | curl -sS "$TEI_URL/info" |
| Embed text | curl -sS -X POST "$TEI_URL/embed" -H 'Content-Type: application/json' -d '{"inputs":"hello world"}' |
| Embed (batch) | curl -sS -X POST "$TEI_URL/embed" -H 'Content-Type: application/json' -d '{"inputs":["a","b"]}' |
| Sparse embeddings (SPLADE) | curl -sS -X POST "$TEI_URL/embed_sparse" -H 'Content-Type: application/json' -d '{"inputs":"hello"}' |
| Rerank against a query | curl -sS -X POST "$TEI_URL/rerank" -H 'Content-Type: application/json' -d '{"query":"fruit","texts":["apple","car"]}' |
| Tokenize | curl -sS -X POST "$TEI_URL/tokenize" -H 'Content-Type: application/json' -d '{"inputs":"hello world"}' |
| OpenAI-compatible embeddings | curl -sS -X POST "$TEI_URL/v1/embeddings" -H 'Content-Type: application/json' -d '{"input":"hello","model":"tei"}' |
/embed and /rerank depend on the loaded model: an embedding model serves /embed (and /rerank returns a 424 model is not a re-ranker error), while a reranker model serves /rerank. Check /info to see which is loaded. /rerank accepts at most 100 texts per call - split larger batches across requests.
Full API reference: https://huggingface.github.io/text-embeddings-inference/
Configuration
Verify the resolved URL before making model calls:
curl -sS "$TEI_URL/health" -w '\nHTTP %{http_code}\n'
When NOT to use this skill
- The user wants to store or search vectors - that's the
qdrantskill. - The phrase is a "teach/team" typo, or the Text Encoding Initiative XML standard - not this skill.