Embeddings | Parasail

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/embeddings

Authentication

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

curl https://api.parasail.io/v1/embeddings \
  -H "Authorization: Bearer $PARASAIL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "parasail-ai/GritLM-7B-vllm",
    "input": "Parasail provides affordable cloud GPUs for AI inference.",
    "encoding_format": "float"
  }'

Parameters

Parameter Type Default Description
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" Either "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:

{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0023, -0.0091, 0.0145, "..."]
    }
  ],
  "model": "parasail-ai/GritLM-7B-vllm",
  "usage": {
    "prompt_tokens": 12,
    "total_tokens": 12
  }
}

Field Descriptions

When input is an array, data contains one object per input, ordered by index.

Available embedding models

Model HuggingFace ID
GritLM parasail-ai/GritLM-7B-vllm
GTE-Qwen2-7B-Instruct Alibaba-NLP/gte-Qwen2-7B-instruct

Any embedding model on HuggingFace can be used with dedicated or batch endpoints.

Error responses

Errors use OpenAI-compatible status codes and a JSON body with an error object (message, type, code).

Status Code Description
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