1.1 KiB
1.1 KiB
| title | source | author | published | created | description | tags | |
|---|---|---|---|---|---|---|---|
| Embeddings | https://lmstudio.ai/docs/developer/openai-compat/embeddings | 2026-04-30 | Generate embedding vectors from input text. |
|
Generate embedding vectors from input text.
- Method:
POST - See OpenAI docs: 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)