Documentation Index Fetch the complete documentation index at: https://docs.electronhub.ai/llms.txt
Use this file to discover all available pages before exploring further.
The Embeddings API enables you to generate numerical representations of text that can be used for semantic search, clustering, and other machine learning tasks.
Create Embeddings
POST /embeddings
Generate embeddings for input text.
Request Body
Input text to embed, encoded as a string or array of strings
The model to use for generating embeddings (e.g., “text-embedding-ada-002”, “text-embedding-3-small”, “text-embedding-3-large”)
The format to return the embeddings in (“float” or “base64”)
The number of dimensions the resulting output embeddings should have (only supported in text-embedding-3 models)
A unique identifier representing your end-user
Response
Returns an embedding object containing the vector embeddings.
Example
const response = await fetch ( 'https://api.electronhub.ai/v1/embeddings' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer YOUR_API_KEY' ,
'Content-Type' : 'application/json'
},
body: JSON . stringify ({
input: 'The quick brown fox jumps over the lazy dog' ,
model: 'text-embedding-3-small'
})
});
const data = await response . json ();
console . log ( data );
You can embed multiple text inputs in a single request:
{
"input" : [
"Text to embed 1" ,
"Text to embed 2" ,
"Text to embed 3"
],
"model" : "text-embedding-3-small"
}
Use Cases
Semantic Search : Find documents similar to a query
Clustering : Group similar texts together
Classification : Train classifiers on embedding features
Recommendation : Recommend items based on similarity
Anomaly Detection : Identify outliers in text data
Best Practices
Use text-embedding-3-small for most use cases (good balance of performance and cost)
Use text-embedding-3-large for maximum performance
Batch multiple inputs in a single request for efficiency
Store embeddings for reuse rather than regenerating them
Enter your API key (starts with 'ek-')
input
string string[] string string[]
required
encoding_format
enum<string>
default: float
Available options:
float,
base64
Number of dimensions for the embedding