Text embeddings are used to measure the relevance between text strings. Embeddings are typically used for:
Search (where results are ranked based on relevance to the query string)
Clustering (where text strings are grouped by similarity)
Recommendations (suggesting items related to relevant text strings)
Anomaly Detection(identifying outliers that are different or less relevant)
Diversity Measurement (analyzing the distribution of similarities)
Classification (categorizing text strings by the most similar label)
An embedding is a list of floating-point numbers (a vector). The distance between two vectors measures their relevance. A small distance indicates high relevance, while a large distance indicates low relevance.Price:0.08 PTC / 1M tokens
Request
Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Header Params
Body Params application/json
Example
{"model":"Baichuan-Text-Embedding","input":"The food was delicious and the waiter..."}
Request Code Samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl--location--request POST 'https://api.302.ai/v1/embeddings' \
--header'Authorization: Bearer <token>' \
--header'Content-Type: application/json' \
--data-raw'{
"model": "Baichuan-Text-Embedding",
"input": "The food was delicious and the waiter..."
}'
Responses
🟢200Create embeddings
application/json
Body
Example
{"object":"list","data":[{"object":"embedding","embedding":[0.0023064255,-0.009327292,
.... (1536 floats total for ada-002)
-0.0028842222],"index":0}],"model":"text-embedding-ada-002","usage":{"prompt_tokens":8,"total_tokens":8}}