> ## Documentation Index
> Fetch the complete documentation index at: https://docs.conare.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Conare's API is at https://api.conare.ai. Authenticate with `Authorization: Bearer $CONARE_API_KEY`.
> The full OpenAPI spec is at https://api.conare.ai/openapi.yaml; each endpoint has a page under /api-reference, and appending .md to any page URL returns its Markdown.
> Embed with model conare-embed-1; send input_type "query" for search queries. Rerank with conare-rerank-1.
> Prefer the TypeScript SDK (`npm install conare`) or plain HTTP in examples.
> Install the Conare skill with `npx skills add https://docs.conare.ai`; search these docs over MCP at https://docs.conare.ai/mcp; the whole site is at https://docs.conare.ai/llms-full.txt.

# Ембединги й переранжування

> Використовуйте моделі ембедингів і переранжування Conare з будь-якою векторною базою даних через ендпоінти, сумісні з OpenAI і Cohere.

Спрямуйте свій клієнт OpenAI або Cohere на `https://api.conare.ai/v1`, щоб використовувати моделі Conare окремо. [Ключ](https://docs.conare.ai/uk/console.md#ключі) типу **Models only** може їх викликати й не має доступу до жодного простору імен.

| Модель | Призначення | Результат |
| - | - | - |
| `conare-embed-1` | Ембединги для документів і запитів | 1 024 виміри |
| `conare-rerank-1` | Переранжування (за замовчуванням) | Оцінка релевантності для кожного документа |

## Ембединги

`POST /v1/embeddings`

Створюйте ембединги документів як є, а пошукових запитів — з `input_type: "query"`.

```bash curl theme={null}
curl https://api.conare.ai/v1/embeddings \
  -H "Authorization: Bearer $CONARE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "conare-embed-1", "input": ["Refunds are available for 30 days."]}'

curl https://api.conare.ai/v1/embeddings \
  -H "Authorization: Bearer $CONARE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "conare-embed-1", "input": "how do refunds work?", "input_type": "query"}'
```

```ts TypeScript theme={null}
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.conare.ai/v1", apiKey: process.env.CONARE_API_KEY });

const docs = await client.embeddings.create({ model: "conare-embed-1", input: ["Refunds are available for 30 days."] });
const query = await client.embeddings.create({
  model: "conare-embed-1",
  input: "how do refunds work?",
  input_type: "query",
} as OpenAI.EmbeddingCreateParams);
```

```python Python theme={null}
import os
from openai import OpenAI

client = OpenAI(base_url="https://api.conare.ai/v1", api_key=os.environ["CONARE_API_KEY"])

docs = client.embeddings.create(model="conare-embed-1", input=["Refunds are available for 30 days."])
query = client.embeddings.create(
    model="conare-embed-1",
    input="how do refunds work?",
    extra_body={"input_type": "query"},
)
```

```json Response theme={null}
{
  "data": [{ "embedding": [0.12506497, 0.07159516, 0.017521178, ...], "index": 0, "object": "embedding" }],
  "model": "conare-embed-1",
  "object": "list",
  "usage": { "prompt_tokens": 12, "total_tokens": 12 }
}
```

| Параметр | Тип | Що робить |
| - | - | - |
| `input` | string або array, обов’язковий | 1-128 текстів, кожен до 32 KiB |
| `model` | string | `conare-embed-1` (за замовчуванням) або id вашої власної моделі |
| `input_type` | string, за замовчуванням `document` | `query` для пошукових запитів |
| `encoding_format` | string, за замовчуванням `float` | `float` або `base64` для little-endian float32 |
| `dimensions` | integer | Лише власна розмірність моделі, 1 024 |

`data` містить по одному `embedding` із 1 024 чисел на кожен вхід разом з його `index`. Повна схема: [Embed texts (OpenAI-compatible)](https://docs.conare.ai/uk/api-reference/models/embed-texts-openai-compatible.md).

## Переранжування

`POST /v1/rerank`

Оцінює документи щодо запиту, спершу найкращі; приймає запит у форматі Cohere, а `/v2/rerank` приймає `ClientV2` від Cohere.

```bash curl theme={null}
curl https://api.conare.ai/v1/rerank \
  -H "Authorization: Bearer $CONARE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "how do refunds work?",
    "documents": ["Orders ship within two days.", "Refunds are available for 30 days."],
    "top_n": 1
  }'
```

```ts TypeScript (SDK) theme={null}
import { Conare } from "conare";

const conare = new Conare();
const ranked = await conare.rerank("how do refunds work?", [
  "Orders ship within two days.",
  "Refunds are available for 30 days.",
]);
// [{ index: 1, score: 0.3468, document: "Refunds are available for 30 days." }, ...]
```

```python Python theme={null}
import os
import cohere

co = cohere.Client(base_url="https://api.conare.ai", api_key=os.environ["CONARE_API_KEY"])

response = co.rerank(
    query="how do refunds work?",
    documents=["Orders ship within two days.", "Refunds are available for 30 days."],
    top_n=1,
)
```

```json Response theme={null}
{
  "id": "d9d8ac5739d77af256c01449d7f23bb2",
  "model": "conare-rerank-1",
  "results": [{ "index": 1, "relevance_score": 0.3484 }],
  "unscored": [],
  "usage": { "total_tokens": 57 }
}
```

| Параметр | Тип | Що робить |
| - | - | - |
| `query` | string, обов’язковий | До 8 192 символів |
| `documents` | array, обов’язковий | 1-100 рядків або об’єктів із `text`; до 1 000 із моделлю, навченою для вас |
| `model` | string | Не вказуйте для `conare-rerank-1`; невідома модель повертає `400` |
| `top_n` | integer | Повертати лише `top_n` найкращих |
| `return_documents` | boolean, за замовчуванням `false` | Додати текст кожного документа як `document` |
| `max_tokens_per_doc` | integer | Обрізати кожен документ приблизно до цієї кількості токенів |

| Поле | Значення |
| - | - |
| `results` | Спершу найкращі: `index` у `documents` і `relevance_score` (що вище, то краще) |
| `unscored` | Документи, до яких переранжувальник не встиг дійти |
| `id`, `usage` | Id запиту й кількість прочитаних токенів |

Повна схема: [Rerank (Cohere-compatible)](https://docs.conare.ai/uk/api-reference/models/rerank-documents-cohere-and-vllm-compatible.md), [Rerank (Cohere v2)](https://docs.conare.ai/uk/api-reference/models/rerank-documents-cohere-v2-compatible.md).

## Моделі

`GET /v1/models`

Повертає в `data` моделі, які може викликати ваш ключ, включно з моделями, навченими для вашої організації.

* Кожна має `id` і `type` (`embedding` або `rerank`); модель, що виводиться з використання, має дату `sunset` і `successor`.
* `GET /v1/models/:id` повертає одну модель або `404 model_not_found`.

Повна схема: [List models](https://docs.conare.ai/uk/api-reference/models/list-models-openai-compatible.md).

## Нативні маршрути

Власний формат Conare, який використовує [SDK](https://docs.conare.ai/uk/sdk.md).

`POST /embed`

```ts TypeScript theme={null}
const [vector] = await conare.embed("how do refunds work?", { type: "query" });
const int8 = await conare.embed("how do refunds work?", { type: "query", outputDtype: "int8" });
```

```json Response theme={null}
{ "dimensions": 1024, "embeddings": [[0.15636191, 0.03499228, -0.003388892, ...]], "model": "conare-embed-1" }
```

| Параметр | Тип | Що робить |
| - | - | - |
| `input` | array, обов’язковий | 1-128 текстів |
| `type` | string, за замовчуванням `document` | `query` для пошукових запитів |
| `output_dtype` | string, за замовчуванням `float` | `int8` повертає цілі числа від -127 до 127 і один масштаб на вектор у `scales`; косинусна подібність та сама |

Повна схема: [Embed texts](https://docs.conare.ai/uk/api-reference/models/embed-texts.md).

`POST /rerank`

```json Response theme={null}
{
  "model": "conare-rerank-1",
  "results": [{ "index": 1, "score": 0.3484 }, { "index": 0, "score": 0.1169 }],
  "unscored": []
}
```

| Параметр | Тип | Що робить |
| - | - | - |
| `query` | string, обов’язковий | До 8 192 символів |
| `documents` | array, обов’язковий | 1-100 рядків або до 1 000 із моделлю, навченою для вас |
| `top_k` | integer | Повертати лише `top_k` найкращих |

Повна схема: [Rerank documents](https://docs.conare.ai/uk/api-reference/models/rerank-documents.md).


## Related topics

- [Вступ](https://docs.conare.ai/uk/index.md)
- [Консоль](https://docs.conare.ai/uk/console.md)
- [Огляд API](https://docs.conare.ai/uk/api.md)
- [Запис документів](https://docs.conare.ai/uk/write.md)
- [MCP](https://docs.conare.ai/uk/mcp-server.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.