Embeddings
Turn text into vectors
POST https://alprouter.com/api/v1/embeddings has been replaced with a list of numbers, which are used for searching and categorizing the text.
from openai import OpenAI
client = OpenAI(
base_url="https://alprouter.com/api/v1",
api_key="alp-your-key",
)
result = client.embeddings.create(
model="cohere/embed-v4.0",
input="Text to search for",
)
print(result.data[0].embedding)- In
input, we can add one entry or a list of entries. At most, 256 entries can be sent at a time. Depending on the model, the number of entries that can be received may be less. encoding_formatreceivesfloatandbase64.- The fee only covers the cost of the input tokens.
- Some models allow you to enter a positive integer in
dimensionsin order to choose the dimensionality of the result.