Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

Update OpenAI Compatibility Docs with /v1/embeddings (#5470)

royjhan558a54b098dc
diff --git a/docs/openai.md b/docs/openai.md
index e4a4af1e5..291953291 100644
--- a/docs/openai.md
+++ b/docs/openai.md
@@ -31,6 +31,11 @@ chat_completion = client.chat.completions.create(
list_completion = client.models.list()
model = client.models.retrieve("llama3")
+
+embeddings = client.embeddings.create(
+ model="all-minilm",
+ input=["why is the sky blue?", "why is the grass green?"]
+)
```
### OpenAI JavaScript library
@@ -53,6 +58,11 @@ const chatCompletion = await openai.chat.completions.create({
const listCompletion = await openai.models.list()
const model = await openai.models.retrieve("llama3");
+
+const embedding = await openai.embeddings.create({
+ model: "all-minilm",
+ input: ["why is the sky blue?", "why is the grass green?"],
+});
```
### `curl`
@@ -77,6 +87,13 @@ curl http://localhost:11434/v1/chat/completions \
curl http://localhost:11434/v1/models
curl https://api.openai.com/v1/models/llama3
+
+curl http://localhost:11434/v1/embeddings \
+ -H "Content-Type: application/json" \
+ -d '{
+ "model": "all-minilm",
+ "input": ["why is the sky blue?", "why is the grass green?"]
+ }'
```
## Endpoints
@@ -128,6 +145,20 @@ curl https://api.openai.com/v1/models/llama3
- `created` corresponds to when the model was last modified
- `owned_by` corresponds to the ollama username, defaulting to `"library"`
+### `/v1/embeddings`
+
+#### Supported request fields
+
+- [x] `model`
+- [x] `input`
+ - [x] string
+ - [x] array of strings
+ - [ ] array of tokens
+ - [ ] array of token arrays
+- [ ] `encoding format`
+- [ ] `dimensions`
+- [ ] `user`
+
## Models
Before using a model, pull it locally `ollama pull`: