> ## 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.

# Embedding e reranking

> Usa i modelli di embedding e reranking di Conare con qualsiasi database vettoriale, tramite endpoint compatibili con OpenAI e Cohere.

Punta il tuo client OpenAI o Cohere su `https://api.conare.ai/v1` per usare i modelli di Conare da soli. Una [chiave](https://docs.conare.ai/it/console.md#chiavi) **Models only** può chiamarli e non raggiunge alcun namespace.

| Modello | Uso | Output |
| - | - | - |
| `conare-embed-1` | Embedding per documenti e query | 1.024 dimensioni |
| `conare-rerank-1` | Reranking (il predefinito) | Un punteggio di pertinenza per documento |

## Embedding

`POST /v1/embeddings`

Calcola l'embedding dei documenti così come sono, e delle query di ricerca con `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 }
}
```

| Opzione | Tipo | Cosa fa |
| - | - | - |
| `input` | string o array, obbligatorio | 1-128 testi, ciascuno fino a 32 KiB |
| `model` | string | `conare-embed-1` (il predefinito), o l'id del tuo modello |
| `input_type` | string, predefinito `document` | `query` per le query di ricerca |
| `encoding_format` | string, predefinito `float` | `float`, o `base64` per float32 little-endian |
| `dimensions` | integer | Solo quelle del modello, 1.024 |

`data` contiene un `embedding` di 1.024 numeri per input, con il suo `index`. Schema completo: [Embed texts (OpenAI-compatible)](https://docs.conare.ai/it/api-reference/models/embed-texts-openai-compatible.md).

## Reranking

`POST /v1/rerank`

Assegna un punteggio ai documenti rispetto a una query, prima i migliori; accetta la richiesta di Cohere, e `/v2/rerank` accetta il `ClientV2` di 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 }
}
```

| Opzione | Tipo | Cosa fa |
| - | - | - |
| `query` | string, obbligatorio | Fino a 8.192 caratteri |
| `documents` | array, obbligatorio | 1-100 stringhe, o oggetti con un `text`; fino a 1.000 con un modello addestrato per te |
| `model` | string | Omettilo per `conare-rerank-1`; un modello sconosciuto restituisce `400` |
| `top_n` | integer | Restituisce solo i migliori `top_n` |
| `return_documents` | boolean, predefinito `false` | Include il testo di ogni documento come `document` |
| `max_tokens_per_doc` | integer | Tronca ogni documento a circa questo numero di token |

| Campo | Significato |
| - | - |
| `results` | Prima i migliori: `index` in `documents` e `relevance_score` (più alto è meglio) |
| `unscored` | Documenti che il reranker non ha raggiunto in tempo |
| `id`, `usage` | L'id della richiesta e i token letti |

Schema completo: [Rerank (Cohere-compatible)](https://docs.conare.ai/it/api-reference/models/rerank-documents-cohere-and-vllm-compatible.md), [Rerank (Cohere v2)](https://docs.conare.ai/it/api-reference/models/rerank-documents-cohere-v2-compatible.md).

## Modelli

`GET /v1/models`

Elenca in `data` i modelli che la tua chiave può chiamare, compresi quelli addestrati per la tua organizzazione.

* Ognuno ha il suo `id` e `type` (`embedding` o `rerank`); un modello in dismissione ha una data `sunset` e un `successor`.
* `GET /v1/models/:id` restituisce un modello, o `404 model_not_found`.

Schema completo: [List models](https://docs.conare.ai/it/api-reference/models/list-models-openai-compatible.md).

## Route native

Il formato proprio di Conare, usato dall'[SDK](https://docs.conare.ai/it/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" }
```

| Opzione | Tipo | Cosa fa |
| - | - | - |
| `input` | array, obbligatorio | 1-128 testi |
| `type` | string, predefinito `document` | `query` per le query di ricerca |
| `output_dtype` | string, predefinito `float` | `int8` restituisce numeri interi da -127 a 127 e una scala per vettore in `scales`; la similarità del coseno è la stessa |

Schema completo: [Embed texts](https://docs.conare.ai/it/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": []
}
```

| Opzione | Tipo | Cosa fa |
| - | - | - |
| `query` | string, obbligatorio | Fino a 8.192 caratteri |
| `documents` | array, obbligatorio | 1-100 stringhe, o fino a 1.000 con un modello addestrato per te |
| `top_k` | integer | Restituisce solo i migliori `top_k` |

Schema completo: [Rerank documents](https://docs.conare.ai/it/api-reference/models/rerank-documents.md).


## Related topics

- [Introduzione](https://docs.conare.ai/it/index.md)
- [Ricerca](https://docs.conare.ai/it/query.md)
- [MCP](https://docs.conare.ai/it/mcp-server.md)
- [Panoramica dell'API](https://docs.conare.ai/it/api.md)
- [Namespace](https://docs.conare.ai/it/namespaces.md)


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