Skip to main content
POST
/
embeddings
Create embeddings
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    model: '<string>',
    input: '<string>',
    inputs: '<string>',
    encoding_format: '<string>',
    dimensions: 2,
    embedding_options: {
      google: {
        output_dimensionality: 2,
        task_type: 'TASK_TYPE_UNSPECIFIED',
        title: '<string>'
      },
      mistral: {output_dimension: 2, output_dtype: 'float'}
    },
    user: '<string>',
    debug: {
      enabled: true,
      return_upstream_request: true,
      return_upstream_response: true,
      trace: true,
      trace_level: 'summary'
    },
    provider: {
      order: ['<string>'],
      only: ['<string>'],
      ignore: ['<string>'],
      include_alpha: true
    }
  })
};

fetch('https://api.phaseo.app/v1/embeddings', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "object": "<string>",
  "data": [
    {
      "object": "<string>",
      "embedding": [
        123
      ],
      "index": 123
    }
  ],
  "model": "<string>",
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}
Embeddings are generated by routing text requests to the provider that currently offers the most accurate semantic vectors for your selected model. The Gateway exposes a single OpenAI-compatible POST /embeddings surface while adapting provider-specific knobs for Google Gemini and Mistral when they are supplied. Key request fields:
  • input (required): A string or array of strings to embed.
  • inputs (alias): Optional alias for input if you prefer that shape.
  • dimensions: Standard OpenAI output size hint.
  • embedding_options: Provider-specific tuning knobs.
    • embedding_options.google.output_dimensionality, embedding_options.google.task_type, embedding_options.google.title
    • embedding_options.mistral.output_dimension, embedding_options.mistral.output_dtype
Use the Models catalogue to see which providers list embeddings under their supported endpoints array. The same authentication headers you use elsewhere apply here as well.

Authorizations

Authorization
string
header
required

Bearer token authentication

Body

application/json
model
string
required
input
required
inputs

Alias for input.

encoding_format
string
dimensions
integer
Required range: x >= 1
embedding_options
object
user
string
debug
object

Gateway debug controls. These flags are never forwarded upstream.

provider
object

Provider routing preferences for gateway selection.

Response

200 - application/json

Embeddings response

object
string
data
object[]
model
string
usage
object
Last modified on February 11, 2026