OhMyGPT
Embeddings

Create embedding

POST
/v1/embeddings

Generate vector representations of text. Supports multiple embedding providers.

Authorization

ApiKeyAuth
headerAuthorization<token>

Request Body

application/json
  1. body
dimensions?integer

The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models.

Range1 <= value
encoding_format?string

The format to return the embeddings in. Can be either float or base64.

Default"float"
Value in"float""base64"
input*|array<>|array<integer>|array<array<integer>>

Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for all embedding models), cannot be an empty string, and any array must be 2048 dimensions or less. Example Python code for counting tokens. In addition to the per-input token limit, all embedding models enforce a maximum of 300,000 tokens summed across all inputs in a single request.

model*|

ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.

user?string

A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.

Response Body

Successful response

application/json
  1. response
data*array<>

The list of embeddings generated by the model.

model*string

The name of the model used to generate the embedding.

object*"list"

The object type, which is always "list".

Value in"list"
usage*

What this request cost. All amounts are in Credits, not USD.

provider?string

The provider that served the request.

Example Request
curl -X POST 'https://api.ohmygpt.com/v1/embeddings' \  -H 'Content-Type: application/json' \  -d '{  "input": "",  "model": "string"}'
Example Response
{  "data": [    {      "embedding": [        0.1      ],      "index": 0,      "object": "embedding"    }  ],  "model": "string",  "object": "list",  "provider": "string",  "usage": {    "prompt_tokens": 0,    "total_tokens": 0,    "billing_mode": "platform",    "cost": 0,    "is_byok": true  }}