Skip to main content

Documentation Index

Fetch the complete documentation index at: https://portkey-docs-portkey-remote-mcp.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

OpenAI’s embedding models transform text into lists of floating-point numbers (vectors). Smaller distances between vectors indicate higher semantic similarity, making them useful for semantic search, content clustering, recommendations, and anomaly detection.

Usage

from portkey_ai import Portkey

client = Portkey(
    api_key="PORTKEY_API_KEY",
    provider="@OPENAI_PROVIDER"
)

response = client.embeddings.create(
    input="Your text string goes here",
    model="text-embedding-3-small"
)

print(response.data[0].embedding)

Supported Models

ModelDimensionsNotes
text-embedding-3-small1536Best cost/performance ratio
text-embedding-3-large3072Highest accuracy
text-embedding-ada-0021536Legacy model

Supported Parameters

ParameterTypeDescription
modelstringEmbedding model ID
inputstring or arrayText to embed. Pass an array to embed multiple strings in one request
encoding_formatstringfloat (default) or base64
dimensionsintegerReduce output dimensions (supported on v3 models only)
userstringEnd-user ID for tracking

FAQs

Use OpenAI’s Tiktoken library to count tokens before making an embedding request.
Use a specialized vector database. See OpenAI’s vector database cookbook for options and examples.
The knowledge cutoff for text-embedding-3-large and text-embedding-3-small is September 2021.
Last modified on May 20, 2026