Embeddings
Embeddings API for generating vector representations of text using open-source models.
Generate vector embeddings for text using open-source embedding models. The API is OpenAI-compatible—use the same client.embeddings.create interface.
Endpoint
POST https://api.parasail.io/v1/embeddingsAuthentication
Pass your API key in the Authorization header:
Authorization: Bearer <PARASAIL_API_KEY>The OpenAI SDK reads this from the api_key argument. See Authentication for how to create and store a key.
Request
Python (OpenAI SDK)
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.parasail.io/v1",
api_key=os.environ["PARASAIL_API_KEY"],
)
response = client.embeddings.create(
model="parasail-ai/GritLM-7B-vllm",
input="Parasail provides affordable cloud GPUs for AI inference.",
encoding_format="base64"
)
print(response.data[0].embedding[:5])cURL
Parameters
model
string
required
Embedding model ID (for example, parasail-ai/GritLM-7B-vllm)
input
string or array
required
Text to embed. Pass an array to embed multiple inputs in one request
encoding_format
string
"float"
"float" or "base64" (recommended for smaller payloads)
These fields follow the OpenAI schema. For exhaustive field semantics, see the OpenAI embeddings reference.
Response
A successful request returns a list of embedding objects. With one input string, data contains a single embedding:
data[].embedding
The vector (array of floats, or a base64 string when encoding_format="base64")
data[].index
Position of this embedding in the input array
usage
Prompt and total token counts
When input is an array, data contains one object per input, ordered by index.
Available embedding models
GritLM
parasail-ai/GritLM-7B-vllm
GTE-Qwen2-7B-Instruct
Alibaba-NLP/gte-Qwen2-7B-instruct
Any embedding model on Hugging Face can be used with a Dedicated Instance.
Error responses
Errors use OpenAI-compatible status codes and a JSON body with an error object (message, type, code).
400
Malformed request—invalid JSON, missing input, or unsupported parameter value
401
Missing or invalid API key
403
API key lacks access to the requested model
404
Model or endpoint not found
429
Rate limit or quota exceeded—back off and retry
500
Internal server error—retry with exponential backoff
Tips
Use
encoding_format="base64"to reduce output sizes.
Next steps
RAG and embeddings use case—RAG pipeline guide
Model selection—embedding model evaluation
Chat completions API—endpoint compatibility matrix and base URL
Last updated