🚢
API Docs
  • С чего начать?
  • Стоимость запросов
  • Интеграция чат-ботов
  • Токенизация
  • API - Ассистенты
    • Assistant API
    • Чат с ассистентом
  • API - Общие запросы
    • Запрос баланса
  • API - OpenAI -ChatGPT
    • Список моделей
    • Запрос чату
  • API - OpenAI - Embedding
    • embedding-ada-v2
    • text-embedding-3-small
    • text-embedding-3-large
  • Moderation
    • text-moderation
  • RAG DATABASE
    • List of RAGs
    • List of files
    • Add file to RAG
    • Delete file from RAG
  • FaceSwap 2.0
    • /create
    • /result
  • Background Remover
    • /create
    • /result
  • API -Midjourney
    • /imagine
    • /result
    • /upsample
    • /variation
    • /outpaint
    • /pan
    • /upscale
    • /inpaint
    • /reroll
Powered by GitBook
On this page
  • Создание векторов
  • Пример запроса
  • Пример ответа
  1. API - OpenAI - Embedding

text-embedding-3-small

Отправить синхронный запрос используя модель text-embedding-3-small

Previousembedding-ada-v2Nexttext-embedding-3-large

Last updated 10 months ago

Чтобы отправлять авторизованные запросы нужно получить API ключ, как это сделать написано в разделе

Создание векторов

POST https://gptunnel.ru/v1/embeddings

Синхронный запрос к модели text-embedding-3-small

Headers

Name
Type
Description

Authorization*

string

API ключ

Request Body

Name
Type
Description

model*

string

ID модели

input*

string

Контент

useWalletBalance

bool

Использовать личный счет

dimensions

number

Кол-во измерений

{
	"object": "list",
	"data": [
		{
			"object": "embedding",
			"index": 0,
			"embedding": [
				-0.007021796,
				"A LOT OF NUMBERS",
				-0.017013576,
				-0.000082575396,
				-0.023988336
			]
		}
	],
	"model": "text-embedding-3-small",
	"usage": {
		"prompt_tokens": 5,
		"total_tokens": 5,
		"prompt_cost": 0.00045,
		"completion_cost": 0,
		"total_cost": 0.00045
	}
}
{
  "error": {
    "message": "The model 'gpt-5' does not exist",
    "type": "invalid_request_error",
    "param": null,
    "code": "model_not_found"
  }
}

{
  "error": {
    "message": "'model' is a required property",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}
{
  "error": {
    "message": "Organization balance is too low to use API",
    "type": "insufficient_balance_error",
    "param": null,
    "code": null
  }
}
{
  "error": {
    "message": "Unauthorized",
    "type": "unauthorized_request_error",
    "param": null,
    "code": null,
  }
}

Пример запроса

import axios from 'axios'

const request = axios({
  method: 'POST',
  url: 'https://gptunnel.ru/v1/embeddings',
  headers: {
    // use your API key here
    Authorization: 'YOUR_API_KEY',
  },
  data: {
     model: "text-embedding-3-small",
     input: "Your text string goes here",
     dimensions: 1024,
  },
})

request.then((result) => {
  console.log(result)
}).catch((error) => {
  console.error(error)
})
curl --request POST \
  --url https://gptunnel.ru/v1/embeddings \
  --header 'Authorization: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
      "model": "text-embedding-3-small",
      "input": "Your text string goes here",
      "dimensions": 1024,
}'

Пример ответа

{
	"object": "list",
	"data": [
		{
			"object": "embedding",
			"index": 0,
			"embedding": [
				-0.007021796,
				"A LOT OF NUMBERS",
				-0.017013576,
				-0.000082575396,
				-0.023988336
			]
		}
	],
	"model": "text-embedding-3-small",
	"usage": {
		"prompt_tokens": 5,
		"total_tokens": 5,
		"prompt_cost": 0.00045,
		"completion_cost": 0,
		"total_cost": 0.00045
	}
}

С чего начать?