--- title: "Embeddings" source: "https://lmstudio.ai/docs/developer/openai-compat/embeddings" author: published: created: 2026-04-30 description: "Generate embedding vectors from input text." tags: - "clippings" --- Generate embedding vectors from input text. - Method: `POST` - See OpenAI docs: [https://platform.openai.com/docs/api-reference/embeddings](https://platform.openai.com/docs/api-reference/embeddings) ##### Python example ``` from openai import OpenAI client = OpenAI(base_url="http://localhost:1234/v1", api_key="lm-studio") def get_embedding(text, model="model-identifier"): text = text.replace("\n", " ") return client.embeddings.create(input=[text], model=model).data[0].embedding print(get_embedding("Once upon a time, there was a cat.")) ```[Completions (Legacy)](https://lmstudio.ai/docs/developer/openai-compat/completions) [ Text completion for base models (legacy OpenAI endpoint). ](https://lmstudio.ai/docs/developer/openai-compat/completions)[ List Models List available models via the OpenAI-compatible endpoint. ](https://lmstudio.ai/docs/developer/openai-compat/models)