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

# Intégration Jina AI

## Description

Nous avons intégré les cinq interfaces principales de Jina AI, vous permettant de construire facilement de puissants agents intelligents. Ces interfaces sont principalement adaptées aux scénarios suivants :

* **Embeddings vectoriels (Embeddings)** : applicables aux scénarios de questions-réponses RAG multimodaux, tels que le service client intelligent, le recrutement intelligent et les questions-réponses sur base de connaissances.
* **Reranking (Rerank)** : en optimisant les résultats candidats des Embeddings et en les triant selon la pertinence thématique, on améliore significativement la qualité des réponses des grands modèles de langage.
* **Deep Search (DeepSearch)** : effectue une recherche et un raisonnement approfondis jusqu'à trouver la meilleure réponse, particulièrement adapté aux tâches complexes telles que les projets de recherche et le développement de solutions produit.
* **Recherche web (Search)** : transmettez une requête et obtenez le corps de texte propre de la page de résultats du moteur de recherche (SERP), prêt à être fourni directement à un LLM pour des questions-réponses connectées au web et du RAG.
* **Lecteur web (Reader)** : transmettez n'importe quelle URL et obtenez le corps Markdown propre de cette page après conversion, idéal pour extraire du contenu web à fournir à un LLM.

<Tip>
  Nous avons enrichi l'API Jina AI pour prendre en charge de futures extensions, l'utilisation peut donc différer légèrement de l'implémentation native officielle.
</Tip>

## Démarrage rapide

Remplacez la `API_KEY` par [AIHUBMIX\_API\_KEY](https://aihubmix.com/token) et le lien d'endpoint du modèle ; les autres paramètres et l'utilisation sont entièrement cohérents avec ceux de [Jina AI officiel](https://jina.ai/).

**Remplacement de l'endpoint :**

* **Embeddings vectoriels (Embeddings)** : `https://jina.ai/embeddings` -> `https://aihubmix.com/v1/embeddings`
* **Reranking (Rerank)** : `https://api.jina.ai/v1/rerank` -> `https://aihubmix.com/v1/rerank`
* **Deep Search (DeepSearch)** : `https://deepsearch.jina.ai/v1/chat/completions` -> `https://aihubmix.com/v1/chat/completions`
* **Recherche web (Search)** : `https://s.jina.ai/?q=` -> `https://aihubmix.com/v1/jina/search?q=`
* **Lecteur web (Reader)** : `https://r.jina.ai/<url>` -> `https://aihubmix.com/v1/jina/reader/<url>`

  <Note>
    Si l’adresse principale actuelle de l’API est indisponible, remplacez le domaine de cette configuration par l’adresse de secours `https://api.inferera.com` ; conservez le chemin inchangé.
  </Note>

## Embeddings

L'Embedding de Jina AI prend en charge à la fois le texte brut et les images multimodales, et excelle dans la gestion des tâches multilingues.

### Request Parameters

<ParamField body="model" type="string" required>
  Model name, available model list:

  * `jina-clip-v2`：Multi-modal, multilingual, 1024-dimensional, 8K context window, 865M parameters
  * `jina-embeddings-v3`：Text model, multilingual, 1024-dimensional, 8K context window, 570M parameters
  * `jina-colbert-v2`：Multi-language ColBERT model, 8K token context, 560M parameters, used for embedding and reranking
  * `jina-embeddings-v2-base-code`：Model optimized for code and document search, 768-dimensional, 8K context window, 137M parameters
</ParamField>

<ParamField body="input" type="array" required>
  Input text or image, different models support different input formats. For text, provide an array of strings; for multi-modal models, provide an array of objects containing text or image fields.
</ParamField>

<ParamField body="embedding_format" type="string" default="float">
  Data type returned, optional values:

  * `float`：Default, return a float array. The most common and easy-to-use format, return a list of floats
  * `binary_int8`：Return as int8 packed binary format. More efficient storage, search, and transmission
  * `binary_uint8`：Return as uint8 packed binary format. More efficient storage, search, and transmission
  * `base64`：Return as base64 encoded string. More efficient transmission
</ParamField>

<ParamField body="dimensions" default="1024" type="integer">
  The number of dimensions used in computation. Supported values:

  * 1024
  * 768
</ParamField>

### 1. Multimodal Usage

<CodeGroup>
  ```shell Curl theme={null}
  curl https://aihubmix.com/v1/embeddings \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d @- <<EOFEOF
    {
      "model": "jina-clip-v2",
      "input": [
          {
              "text": "A beautiful sunset over the beach"
          },
          {
              "text": "Un beau coucher de soleil sur la plage"
          },
          {
              "text": "海滩上美丽的日落"
          },
          {
              "text": "浜辺に沈む美しい夕日"
          },
          {
              "image": "https://i.ibb.co/nQNGqL0/beach1.jpg"
          },
          {
              "image": "https://i.ibb.co/r5w8hG8/beach2.jpg"
          },
          {
              "image": "R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7"
          }
      ]
    }
  EOFEOF
  ```

  ```py Python theme={null}
  import requests
  import json

  url = 'https://aihubmix.com/v1/embeddings'
  headers = {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer sk-***' # Replace it by your AiHubMix Key
  }

  data = {
      "model": "jina-clip-v2",
      "input": [
          {
              "text": "A beautiful sunset over the beach"
          },
          {
              "text": "Un beau coucher de soleil sur la plage"
          },
          {
              "text": "海滩上美丽的日落"
          },
          {
              "text": "浜辺に沈む美しい夕日"
          },
          {
              "image": "https://i.ibb.co/nQNGqL0/beach1.jpg"
          },
          {
              "image": "https://i.ibb.co/r5w8hG8/beach2.jpg"
          },
          {
              "image": "R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7"
          }
      ]
  }

  response = requests.post(url, headers=headers, data=json.dumps(data))

  print(response.json())
  ```

  ```ts TypeScript theme={null}
  import fetch from 'node-fetch';

  const url = 'https://aihubmix.com/v1/embeddings';
  const headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer sk-***' // Replace it by your AiHubMix Key
  };
  const data = {
    "model": "jina-clip-v2",
    "input": [
      {
        "text": "A beautiful sunset over the beach"
      },
      {
        "text": "Un beau coucher de soleil sur la plage"
      },
      {
        "text": "海滩上美丽的日落"
      },
      {
        "text": "浜辺に沈む美しい夕日"
      },
      {
        "image": "https://i.ibb.co/nQNGqL0/beach1.jpg"
      },
      {
        "image": "https://i.ibb.co/r5w8hG8/beach2.jpg"
      },
      {
        "image": "R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7"
      }
    ]
  };

  fetch(url, {
    method: 'POST',
    headers: headers,
    body: JSON.stringify(data)
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(err => console.error(err));

  ```
</CodeGroup>

### 2. Pure Text Usage

Only provide an array of text strings, do not provide the `image` field.

<CodeGroup>
  ```shell Curl theme={null}
  curl https://aihubmix.com/v1/rerank \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d @- <<EOFEOF
    {
      "model": "jina-embeddings-v3",
      "input": [
          "A beautiful sunset over the beach",
          "Un beau coucher de soleil sur la plage",
          "海滩上美丽的日落",
          "浜辺に沈む美しい夕日"
      ]
    }
  EOFEOF
  ```

  ```py Python theme={null}
  import requests

  url = 'https://aihubmix.com/v1/embeddings'
  headers = {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer sk-***' # Replace it by your AiHubMix Key
  }
  data = {
      'model': 'jina-embeddings-v3',
      'input': [
          'A beautiful sunset over the beach',
          'Un beau coucher de soleil sur la plage',
          '海滩上美丽的日落',
          '浜辺に沈む美しい夕日'
      ]
  }

  response = requests.post(url, headers=headers, json=data)

  print(response.json())
  ```

  ```ts TypeScript theme={null}
  import * as https from 'https';

  const options = {
    hostname: 'aihubmix.com',
    path: '/v1/embeddings',   
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer sk-***' // Replace it by your AiHubMix Key
    }
  };

  const data = JSON.stringify({
    "model": "jina-embeddings-v3",
    "input": [
      "A beautiful sunset over the beach",
      "Un beau coucher de soleil sur la plage",
      "海滩上美丽的日落",
      "浜辺に沈む美しい夕日"
    ]
  });

  const req = https.request(options, res => {
    let responseData = '';
    res.on('data', chunk => {
      responseData += chunk;
    });
    res.on('end', () => {
      console.log(responseData);
    });
  });

  req.write(data);
  req.end();

  ```
</CodeGroup>

## Rerank

Le Reranker vise à améliorer la pertinence des recherches et la précision du RAG. Il analyse en profondeur les résultats initiaux de la recherche, prend en compte les interactions subtiles entre la requête et le contenu des documents, et réordonne les résultats afin de placer les plus pertinents en tête.

### Request Parameters

<ParamField body="model" type="string" required>
  Model name, available model list:

  * `jina-reranker-m0`：Multimodal multilingual document reranker, 10K context, 2.4B parameters, for visual document sorting
</ParamField>

<ParamField body="query" type="string" required>
  Search query text, used to compare with candidate documents
</ParamField>

<ParamField body="top_n" type="integer">
  The number of most relevant documents to return. Default returns all documents
</ParamField>

<ParamField body="documents" type="array" required>
  Array of candidate documents, will be reordered based on relevance to the query
</ParamField>

<ParamField body="max_chunk_per_doc" default="4096" type="integer">
  Maximum chunk length per document, applicable **only** to Cohere (not supported by Jina). Defaults to 4096.\
  Long documents will be automatically truncated to the specified number of tokens.
</ParamField>

### 1. Multimodal Usage

<CodeGroup>
  ```shell Curl theme={null}
  curl https://aihubmix.com/v1/rerank \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d @- <<EOFEOF
    {
      "model": "jina-reranker-m0",
      "query": "small language model data extraction",
      "documents": [
          {
              "image": "https://raw.githubusercontent.com/jina-ai/multimodal-reranker-test/main/handelsblatt-preview.png"
          },
          {
              "image": "https://raw.githubusercontent.com/jina-ai/multimodal-reranker-test/main/paper-11.png"
          },
          {
              "image": "https://raw.githubusercontent.com/jina-ai/multimodal-reranker-test/main/wired-preview.png"
          },
          {
              "text": "We present ReaderLM-v2, a compact 1.5 billion parameter language model designed for efficient web content extraction. Our model processes documents up to 512K tokens, transforming messy HTML into clean Markdown or JSON formats with high accuracy -- making it an ideal tool for grounding large language models. The models effectiveness results from two key innovations: (1) a three-stage data synthesis pipeline that generates high quality, diverse training data by iteratively drafting, refining, and critiquing web content extraction; and (2) a unified training framework combining continuous pre-training with multi-objective optimization. Intensive evaluation demonstrates that ReaderLM-v2 outperforms GPT-4o-2024-08-06 and other larger models by 15-20% on carefully curated benchmarks, particularly excelling at documents exceeding 100K tokens, while maintaining significantly lower computational requirements."
          },
          {
              "image": "https://jina.ai/blog-banner/using-deepseek-r1-reasoning-model-in-deepsearch.webp"
          },
          {
              "text": "Data extraction? Why not just use regular expressions—wouldn't regex solve it all?"
          },
          {
              "text": "During the California Gold Rush, some merchants made more money selling supplies to miners than the miners made finding gold."
          },
          {
              "text": "Die wichtigsten Beiträge unserer Arbeit sind zweifach: Erstens führen wir eine neuartige dreistufige Datensynthese-Pipeline namens Draft-Refine-Critique ein, die durch iterative Verfeinerung hochwertige Trainingsdaten generiert; und zweitens schlagen wir eine umfassende Trainingsstrategie vor, die kontinuierliches Vortraining zur Längenerweiterung, überwachtes Feintuning mit spezialisierten Kontrollpunkten, direkte Präferenzoptimierung (DPO) und iteratives Self-Play-Tuning kombiniert. Um die weitere Forschung und Anwendung der strukturierten Inhaltsextraktion zu erleichtern, ist das Modell auf Hugging Face öffentlich verfügbar."
          },
          {
              "image": "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"
          }
      ]
    }
  EOFEOF
  ```

  ```py Python theme={null}
  import requests

  url = 'https://aihubmix.com/v1/rerank'
  headers = {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer sk-***' # Replace it by your AiHubMix Key 
  }
  data = {
      "model": "jina-reranker-m0",
      "query": "small language model data extraction",
      "documents": [
          {
              "image": "https://raw.githubusercontent.com/jina-ai/multimodal-reranker-test/main/handelsblatt-preview.png"
          },
          {
              "image": "https://raw.githubusercontent.com/jina-ai/multimodal-reranker-test/main/paper-11.png"
          },
          {
              "image": "https://raw.githubusercontent.com/jina-ai/multimodal-reranker-test/main/wired-preview.png"
          },
          {
              "text": "We present ReaderLM-v2, a compact 1.5 billion parameter language model designed for efficient web content extraction. Our model processes documents up to 512K tokens, transforming messy HTML into clean Markdown or JSON formats with high accuracy -- making it an ideal tool for grounding large language models. The models effectiveness results from two key innovations: (1) a three-stage data synthesis pipeline that generates high quality, diverse training data by iteratively drafting, refining, and critiquing web content extraction; and (2) a unified training framework combining continuous pre-training with multi-objective optimization. Intensive evaluation demonstrates that ReaderLM-v2 outperforms GPT-4o-2024-08-06 and other larger models by 15-20% on carefully curated benchmarks, particularly excelling at documents exceeding 100K tokens, while maintaining significantly lower computational requirements."
          },
          {
              "image": "https://jina.ai/blog-banner/using-deepseek-r1-reasoning-model-in-deepsearch.webp"
          },
          {
              "text": "Data extraction? Why not just use regular expressions—wouldn't regex solve it all?"
          },
          {
              "text": "During the California Gold Rush, some merchants made more money selling supplies to miners than the miners made finding gold."
          },
          {
              "text": "Die wichtigsten Beiträge unserer Arbeit sind zweifach: Erstens führen wir eine neuartige dreistufige Datensynthese-Pipeline namens Draft-Refine-Critique ein, die durch iterative Verfeinerung hochwertige Trainingsdaten generiert; und zweitens schlagen wir eine umfassende Trainingsstrategie vor, die kontinuierliches Vortraining zur Längenerweiterung, überwachtes Feintuning mit spezialisierten Kontrollpunkten, direkte Präferenzoptimierung (DPO) und iteratives Self-Play-Tuning kombiniert. Um die weitere Forschung und Anwendung der strukturierten Inhaltsextraktion zu erleichtern, ist das Modell auf Hugging Face öffentlich verfügbar."
          },
          {
              "image": "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"
          }
      ]
  }

  response = requests.post(url, headers=headers, json=data)

  print(response.json())

  ```

  ```ts TypeScript theme={null}
  import fetch from 'node-fetch';

  const url = 'https://aihubmix.com/v1/rerank';

  const options = {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer sk-***' // Replace it by your AiHubMix Key
    },
    body: JSON.stringify({
      model: 'jina-reranker-m0',
      query: 'small language model data extraction',
      documents: [
        {
          image: 'https://raw.githubusercontent.com/jina-ai/multimodal-reranker-test/main/handelsblatt-preview.png'
        },
        {
          image: 'https://raw.githubusercontent.com/jina-ai/multimodal-reranker-test/main/paper-11.png'
        },
        {
          image: 'https://raw.githubusercontent.com/jina-ai/multimodal-reranker-test/main/wired-preview.png'
        },
        {
          text: 'We present ReaderLM-v2, a compact 1.5 billion parameter language model designed for efficient web content extraction. Our model processes documents up to 512K tokens, transforming messy HTML into clean Markdown or JSON formats with high accuracy -- making it an ideal tool for grounding large language models. The models effectiveness results from two key innovations: (1) a three-stage data synthesis pipeline that generates high quality, diverse training data by iteratively drafting, refining, and critiquing web content extraction; and (2) a unified training framework combining continuous pre-training with multi-objective optimization. Intensive evaluation demonstrates that ReaderLM-v2 outperforms GPT-4o-2024-08-06 and other larger models by 15-20% on carefully curated benchmarks, particularly excelling at documents exceeding 100K tokens, while maintaining significantly lower computational requirements.'
        },
        {
          image: 'https://jina.ai/blog-banner/using-deepseek-r1-reasoning-model-in-deepsearch.webp'
        },
        {
          text: 'Data extraction? Why not just use regular expressions—wouldn\'t regex solve it all?'
        },
        {
          text: 'During the California Gold Rush, some merchants made more money selling supplies to miners than the miners made finding gold.'
        },
        {
          text: 'Die wichtigsten Beiträge unserer Arbeit sind zweifach: Erstens führen wir eine neuartige dreistufige Datensynthese-Pipeline namens Draft-Refine-Critique ein, die durch iterative Verfeinerung hochwertige Trainingsdaten generiert; und zweitens schlagen wir eine umfassende Trainingsstrategie vor, die kontinuierliches Vortraining zur Längenerweiterung, überwachtes Feintuning mit spezialisierten Kontrollpunkten, direkte Präferenzoptimierung (DPO) und iteratives Self-Play-Tuning kombiniert. Um die weitere Forschung und Anwendung der strukturierten Inhaltsextraktion zu erleichtern, ist das Modell auf Hugging Face öffentlich verfügbar.'
        },
        {
          image: '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'
        }
      ]
    })
  };

  fetch(url, options)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
  ```
</CodeGroup>

### Response Description

```json theme={null}
{
  "model": "jina-reranker-m0",
  "results": [
    {
      "index": 1,
      "relevance_score": 0.8814517277012487
    },
    {
      "index": 3,
      "relevance_score": 0.7756727858283531
    },
    {
      "index": 7,
      "relevance_score": 0.6128658982982312
    }
  ],
  "usage": {
    "total_tokens": 2894
  }
}
```

**Response successful:**

* `model`: The name of the model used
* `results`: An array of reranking results sorted by relevance score in descending order, each element contains:
  * `index`: The index position in the original document array
  * `relevance_score`: A relevance score between 0-1, higher scores indicate greater relevance to the query
* `usage`: Usage statistics
  * `total_tokens`: Total number of tokens processed in this request

### 2. Text Usage

Text reranking supports both multilingual and regular tasks, similar to embedding usage, by passing in an array.

<CodeGroup>
  ```shell Curl theme={null}
  curl https://aihubmix.com/v1/rerank \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d @- <<EOFEOF
    {
      "model": "jina-reranker-v2-base-multilingual",
      "query": "Organic skincare products for sensitive skin",
      "top_n": 3,
      "documents": [
          "Organic skincare for sensitive skin with aloe vera and chamomile: Imagine the soothing embrace of nature with our organic skincare range, crafted specifically for sensitive skin. Infused with the calming properties of aloe vera and chamomile, each product provides gentle nourishment and protection. Say goodbye to irritation and hello to a glowing, healthy complexion.",
          "New makeup trends focus on bold colors and innovative techniques: Step into the world of cutting-edge beauty with this seasons makeup trends. Bold, vibrant colors and groundbreaking techniques are redefining the art of makeup. From neon eyeliners to holographic highlighters, unleash your creativity and make a statement with every look.",
          "Bio-Hautpflege für empfindliche Haut mit Aloe Vera und Kamille: Erleben Sie die wohltuende Wirkung unserer Bio-Hautpflege, speziell für empfindliche Haut entwickelt. Mit den beruhigenden Eigenschaften von Aloe Vera und Kamille pflegen und schützen unsere Produkte Ihre Haut auf natürliche Weise. Verabschieden Sie sich von Hautirritationen und genießen Sie einen strahlenden Teint.",
          "Neue Make-up-Trends setzen auf kräftige Farben und innovative Techniken: Tauchen Sie ein in die Welt der modernen Schönheit mit den neuesten Make-up-Trends. Kräftige, lebendige Farben und innovative Techniken setzen neue Maßstäbe. Von auffälligen Eyelinern bis hin zu holografischen Highlightern – lassen Sie Ihrer Kreativität freien Lauf und setzen Sie jedes Mal ein Statement.",
          "Cuidado de la piel orgánico para piel sensible con aloe vera y manzanilla: Descubre el poder de la naturaleza con nuestra línea de cuidado de la piel orgánico, diseñada especialmente para pieles sensibles. Enriquecidos con aloe vera y manzanilla, estos productos ofrecen una hidratación y protección suave. Despídete de las irritaciones y saluda a una piel radiante y saludable.",
          "Las nuevas tendencias de maquillaje se centran en colores vivos y técnicas innovadoras: Entra en el fascinante mundo del maquillaje con las tendencias más actuales. Colores vivos y técnicas innovadoras están revolucionando el arte del maquillaje. Desde delineadores neón hasta iluminadores holográficos, desata tu creatividad y destaca en cada look.",
          "针对敏感肌专门设计的天然有机护肤产品：体验由芦荟和洋甘菊提取物带来的自然呵护。我们的护肤产品特别为敏感肌设计，温和滋润，保护您的肌肤不受刺激。让您的肌肤告别不适，迎来健康光彩。",
          "新的化妆趋势注重鲜艳的颜色和创新的技巧：进入化妆艺术的新纪元，本季的化妆趋势以大胆的颜色和创新的技巧为主。无论是霓虹眼线还是全息高光，每一款妆容都能让您脱颖而出，展现独特魅力。",
          "敏感肌のために特別に設計された天然有機スキンケア製品: アロエベラとカモミールのやさしい力で、自然の抱擁を感じてください。敏感肌用に特別に設計された私たちのスキンケア製品は、肌に優しく栄養を与え、保護します。肌トラブルにさようなら、輝く健康な肌にこんにちは。",
          "新しいメイクのトレンドは鮮やかな色と革新的な技術に焦点を当てています: 今シーズンのメイクアップトレンドは、大胆な色彩と革新的な技術に注目しています。ネオンアイライナーからホログラフィックハイライターまで、クリエイティビティを解き放ち、毎回ユニークなルックを演出しましょう。"
      ]
    }
  EOFEOF
  ```

  ```py Python theme={null}
  import requests

  url = 'https://aihubmix.com/v1/rerank'
  headers = {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer sk-***' # Replace it by your AiHubMix Key
  }
  data = {
      "model": "jina-reranker-v2-base-multilingual",
      "query": "Organic skincare products for sensitive skin",
      "top_n": 3,
      "documents": [
          "Organic skincare for sensitive skin with aloe vera and chamomile: Imagine the soothing embrace of nature with our organic skincare range, crafted specifically for sensitive skin. Infused with the calming properties of aloe vera and chamomile, each product provides gentle nourishment and protection. Say goodbye to irritation and hello to a glowing, healthy complexion.",
          "New makeup trends focus on bold colors and innovative techniques: Step into the world of cutting-edge beauty with this seasons makeup trends. Bold, vibrant colors and groundbreaking techniques are redefining the art of makeup. From neon eyeliners to holographic highlighters, unleash your creativity and make a statement with every look.",
          "Bio-Hautpflege für empfindliche Haut mit Aloe Vera und Kamille: Erleben Sie die wohltuende Wirkung unserer Bio-Hautpflege, speziell für empfindliche Haut entwickelt. Mit den beruhigenden Eigenschaften von Aloe Vera und Kamille pflegen und schützen unsere Produkte Ihre Haut auf natürliche Weise. Verabschieden Sie sich von Hautirritationen und genießen Sie einen strahlenden Teint.",
          "Neue Make-up-Trends setzen auf kräftige Farben und innovative Techniken: Tauchen Sie ein in die Welt der modernen Schönheit mit den neuesten Make-up-Trends. Kräftige, lebendige Farben und innovative Techniken setzen neue Maßstäbe. Von auffälligen Eyelinern bis hin zu holografischen Highlightern – lassen Sie Ihrer Kreativität freien Lauf und setzen Sie jedes Mal ein Statement.",
          "Cuidado de la piel orgánico para piel sensible con aloe vera y manzanilla: Descubre el poder de la naturaleza con nuestra línea de cuidado de la piel orgánico, diseñada especialmente para pieles sensibles. Enriquecidos con aloe vera y manzanilla, estos productos ofrecen una hidratación y protección suave. Despídete de las irritaciones y saluda a una piel radiante y saludable.",
          "Las nuevas tendencias de maquillaje se centran en colores vivos y técnicas innovadoras: Entra en el fascinante mundo del maquillaje con las tendencias más actuales. Colores vivos y técnicas innovadoras están revolucionando el arte del maquillaje. Desde delineadores neón hasta iluminadores holográficos, desata tu creatividad y destaca en cada look.",
          "针对敏感肌专门设计的天然有机护肤产品：体验由芦荟和洋甘菊提取物带来的自然呵护。我们的护肤产品特别为敏感肌设计，温和滋润，保护您的肌肤不受刺激。让您的肌肤告别不适，迎来健康光彩。",
          "新的化妆趋势注重鲜艳的颜色和创新的技巧：进入化妆艺术的新纪元，本季的化妆趋势以大胆的颜色和创新的技巧为主。无论是霓虹眼线还是全息高光，每一款妆容都能让您脱颖而出，展现独特魅力。",
          "敏感肌のために特別に設計された天然有機スキンケア製品: アロエベラとカモミールのやさしい力で、自然の抱擁を感じてください。敏感肌用に特別に設計された私たちのスキンケア製品は、肌に優しく栄養を与え、保護します。肌トラブルにさようなら、輝く健康な肌にこんにちは。",
          "新しいメイクのトレンドは鮮やかな色と革新的な技術に焦点を当てています: 今シーズンのメイクアップトレンドは、大胆な色彩と革新的な技術に注目しています。ネオンアイライナーからホログラフィックハイライターまで、クリエイティビティを解き放ち、毎回ユニークなルックを演出しましょう。"
      ]
  }

  response = requests.post(url, headers=headers, json=data)

  print(response.json())
  ```

  ```ts TypeScript theme={null}
  const https = require('https');

  const requestData = {
    model: "jina-reranker-v2-base-multilingual",
    query: "Organic skincare products for sensitive skin",
    top_n: 3,
    documents: [
      "Organic skincare for sensitive skin with aloe vera and chamomile: Imagine the soothing embrace of nature with our organic skincare range, crafted specifically for sensitive skin. Infused with the calming properties of aloe vera and chamomile, each product provides gentle nourishment and protection. Say goodbye to irritation and hello to a glowing, healthy complexion.",
      "New makeup trends focus on bold colors and innovative techniques: Step into the world of cutting-edge beauty with this seasons makeup trends. Bold, vibrant colors and groundbreaking techniques are redefining the art of makeup. From neon eyeliners to holographic highlighters, unleash your creativity and make a statement with every look.",
      "Bio-Hautpflege für empfindliche Haut mit Aloe Vera und Kamille: Erleben Sie die wohltuende Wirkung unserer Bio-Hautpflege, speziell für empfindliche Haut entwickelt. Mit den beruhigenden Eigenschaften von Aloe Vera und Kamille pflegen und schützen unsere Produkte Ihre Haut auf natürliche Weise. Verabschieden Sie sich von Hautirritationen und genießen Sie einen strahlenden Teint.",
      "Neue Make-up-Trends setzen auf kräftige Farben und innovative Techniken: Tauchen Sie ein in die Welt der modernen Schönheit mit den neuesten Make-up-Trends. Kräftige, lebendige Farben und innovative Techniken setzen neue Maßstäbe. Von auffälligen Eyelinern bis hin zu holografischen Highlightern – lassen Sie Ihrer Kreativität freien Lauf und setzen Sie jedes Mal ein Statement.",
      "Cuidado de la piel orgánico para piel sensible con aloe vera y manzanilla: Descubre el poder de la naturaleza con nuestra línea de cuidado de la piel orgánico, diseñada especialmente para pieles sensibles. Enriquecidos con aloe vera y manzanilla, estos productos ofrecen una hidratación y protección suave. Despídete de las irritaciones y saluda a una piel radiante y saludable.",
      "Las nuevas tendencias de maquillaje se centran en colores vivos y técnicas innovadoras: Entra en el fascinante mundo del maquillaje con las tendencias más actuales. Colores vivos y técnicas innovadoras están revolucionando el arte del maquillaje. Desde delineadores neón hasta iluminadores holográficos, desata tu creatividad y destaca en cada look.",
      "针对敏感肌专门设计的天然有机护肤产品：体验由芦荟和洋甘菊提取物带来的自然呵护。我们的护肤产品特别为敏感肌设计，温和滋润，保护您的肌肤不受刺激。让您的肌肤告别不适，迎来健康光彩。",
      "新的化妆趋势注重鲜艳的颜色和创新的技巧：进入化妆艺术的新纪元，本季的化妆趋势以大胆的颜色和创新的技巧为主。无论是霓虹眼线还是全息高光，每一款妆容都能让您脱颖而出，展现独特魅力。",
      "敏感肌のために特別に設計された天然有機スキンケア製品：アロエベラとカモミールのやさしい力で、自然の抱擁を感じてください。敏感肌用に特別に設計された私たちのスキンケア製品は、肌に優しく栄養を与え、保護します。肌トラブルにさようなら、輝く健康な肌にこんにちは。",
      "新しいメイクのトレンドは鮮やかな色と革新的な技術に焦点を当てています：今シーズンのメイクアップトレンドは、大胆な色彩と革新的な技術に注目しています。ネオンアイライナーからホログラフィックハイライターまで、クリエイティビティを解き放ち、毎回ユニークなルックを演出しましょう。"
    ]
  };

  const options = {
    hostname: 'aihubmix.com',
    port: 443,
    path: '/v1/rerank',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer sk-***' // Replace it by your AiHubMix Key
    }
  };

  const req = https.request(options, res => {
    let responseData = '';
    res.on('data', chunk => {
      responseData += chunk;
    });
    res.on('end', () => {
      console.log(responseData);
    });
  });

  req.write(JSON.stringify(requestData));
  req.end();
  ```
</CodeGroup>

## DeepSearch

DeepSearch combine des capacités de recherche, de lecture et de raisonnement pour obtenir la meilleure réponse possible. Il est entièrement compatible avec le format Chat API d'OpenAI — il suffit de remplacer api.openai.com par aihubmix.com pour démarrer.
Le flux renvoie également le processus de réflexion.

### Request Parameters

<ParamField body="model" type="string" required>
  Model name, available models:

  * `jina-deepsearch-v1`：Default model, search, read and reason until the best answer is found
</ParamField>

<ParamField body="stream" type="boolean" default="true">
  Whether to enable streaming response. It is strongly recommended to keep this option enabled, DeepSearch requests may take a long time to complete, disabling streaming may result in a '524 Timeout' error
</ParamField>

<ParamField body="messages" type="array" required>
  The list of conversation messages between the user and the assistant. Supports multiple types (modal) messages, such as text (.txt, .pdf), images (.png, .webp, .jpeg), etc. The maximum file size is 10MB
</ParamField>

### Multimodal Message Format

DeepSearch supports multiple types of message formats, which can include pure text (message), files (file), and images (image). The following are examples of different formats:

#### 1. Pure Text Message

```json theme={null}
{
  "role": "user",
  "content": "hi"
}
```

#### 2. Message with File Attachment

```json theme={null}
{
  "role": "user",
  "content": [
    {
      "type": "text",
      "text": "what's in this file?"
    },
    {
      "type": "file",
      "data": "data:application/pdf;base64,JVBERi0xLjQKJfbk...", // PDF 文件的 base64 编码
      "mimeType": "application/pdf"
    }
  ]
}
```

#### 3. Message with Image

```json theme={null}
{
  "role": "user",
  "content": [
    {
      "type": "text",
      "text": "what's in the image?"
    },
    {
      "type": "image",
      "image": "data:image/webp;base64,UklGRoDOAAB...", // the base64 encoding of images
      "mimeType": "image/webp"
    }
  ]
}
```

All files and images must be encoded in data URI format (data URI) in advance, with a maximum file size of 10MB.

### Example of Calling

Please note that **Jina AI's Python streaming call on the official website will not have a response**; please refer to our example.

<CodeGroup>
  ```shell Curl theme={null}
  curl https://aihubmix.com/v1/chat/completions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d @- <<EOFEOF
    {
      "model": "jina-deepsearch-v1",
      "messages": [
          {
              "role": "user",
              "content": "Hi!"
          },
          {
              "role": "assistant",
              "content": "Hi, how can I help you?"
          },
          {
              "role": "user",
              "content": "what's the latest blog post from jina ai?"
          }
      ],
      "stream": true
    }
  EOFEOF
  ```

  ```py Python theme={null}
  import requests
  import json

  url = 'https://aihubmix.com/v1/chat/completions'
  headers = {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer sk-***' # Replace it by your AiHubMix Key
  }

  data = {
      "model": "jina-deepsearch-v1",
      "messages": [
          {
              "role": "user",
              "content": "Hi!"
          },
          {
              "role": "assistant",
              "content": "Hi, how can I help you?"
          },
          {
              "role": "user",
              "content": "what's the latest blog post from jina ai?"
          }
      ],
      "stream": True
  }

  # Use stream=True in the request to handle streaming responses
  response = requests.post(url, headers=headers, json=data, stream=True)

  # Check if the request was successful
  if response.status_code == 200:
      # Iterate over the response content line by line
      for line in response.iter_lines():
          if line:
              # Decode line and print (assuming SSE format: "data: {...}")
              decoded_line = line.decode('utf-8')
              if decoded_line.startswith('data: '):
                  # Handle potential end signal like "data: [DONE]"
                  if decoded_line[len('data: '):].strip() == '[DONE]':
                      print("\nStream finished.")
                      break
                  try:
                      # Extract the JSON part
                      json_data = json.loads(decoded_line[len('data: '):])
                      # Process the JSON data
                      if 'choices' in json_data and len(json_data['choices']) > 0:
                          delta = json_data['choices'][0].get('delta', {})
                          content_to_print = delta.get('content') or delta.get('reasoning_content') # Check both fields

                          if content_to_print:
                              print(content_to_print, end='', flush=True)
                  except json.JSONDecodeError:
                      # Ignore lines that are not valid JSON after "data: "
                      # print(f"\nCould not decode JSON from line: {decoded_line}")
                      pass # Optionally log or handle non-JSON data lines if needed
              # Handle lines that don't start with "data: " if necessary
              # else:
              #    print(f"Received non-data line: {decoded_line}")

      print() # Add a newline at the end
  elif response.status_code == 401:
       print(f"Error: {response.status_code} - Unauthorized. Please check your API key.")
       try:
           print(response.json())
       except json.JSONDecodeError:
           print(response.text)
  else:
      print(f"Error: {response.status_code}")
      try:
          print(response.json()) # Print error details if available
      except json.JSONDecodeError:
          print(response.text) # Print raw text if not JSON
  ```

  ```ts TypeScript theme={null}
  const https = require('https');

  const data = JSON.stringify({
    model: "jina-deepsearch-v1",
    messages: [
      {
        role: "user",
        content: "Hi!"
      },
      {
        role: "assistant",
        content: "Hi, how can I help you?"
      },
      {
        role: "user",
        content: "what's the latest blog post from jina ai?"
      }
    ],
    stream: true
  });

  const options = {
    hostname: 'aihubmix.com',
    path: '/v1/chat/completions',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Content-Length': data.length,
      'Authorization': 'Bearer sk-***' // Replace it by your AiHubMix Key
    }
  };

  const req = https.request(options, res => {
    console.log(`statusCode: ${res.statusCode}`);

    res.on('data', d => {
      process.stdout.write(d);
    });
  });

  req.on('error', error => {
    console.error(error);
  });

  req.write(data);
  req.end();
  ```
</CodeGroup>

### Response Description

The response from DeepSearch is streamed by default, including both intermediate reasoning steps and the final answer.
The last block of the stream contains the final response, a list of visited URLs, and token usage details.
If streaming is disabled, only the final answer will be returned—intermediate "thinking" steps will be omitted.
**Note:** This JSON object differs from the format used by Jina AI.

```json theme={null}
{
  "id": "1745506101379",
  "object": "chat.completion.chunk",
  "created": 1745506101,
  "model": "jina-deepsearch-v1",
  "choices": [
    {
      "index": 0,
      "delta": {
        "role": "assistant",
        "reasoning_content": "<think>"
      }
    }
  ],
  "system_fingerprint": "fp_1745506101379"
}

// Streaming reason
{
  "id": "1745506101379",
  "object": "chat.completion.chunk",
  "created": 1745506101,
  "model": "jina-deepsearch-v1",
  "choices": [
    {
      "index": 0,
      "delta": {
        "reasoning_content": "thinking parts"
      }
    }
  ],
  "system_fingerprint": "fp_1745506101379"
}

// Reasoning finished
{
  "id": "1745506101379",
  "object": "chat.completion.chunk",
  "created": 1745506101,
  "model": "jina-deepsearch-v1",
  "choices": [
    {
      "index": 0,
      "delta": {
        "reasoning_content": "</think>\n\n"
      },
      "finish_reason": "thinking_end"
    }
  ],
  "system_fingerprint": "fp_1745506101379"
}

// The Final Response with URL
{
  "id": "1745506101379",
  "object": "chat.completion.chunk",
  "created": 1745506101,
  "model": "jina-deepsearch-v1",
  "choices": [
    {
      "index": 0,
      "delta": {
        "content": "Response content",
        "type": "text",
        "annotations": [
          {
            "type": "url_citation",
            "url_citation": {
              "url": "https://example.com",
              "title": "Page Title",
              "start_index": 0,
              "end_index": 0
            }
          }
        ]
      },
      "finish_reason": "stop"
    }
  ],
  "system_fingerprint": "fp_1745506101379",
  "usage": {
    "prompt_tokens": 673423,
    "completion_tokens": 109286,
    "total_tokens": 583555
  }
}

data: [DONE]
```

**Python Return Example:**

```py Python theme={null}
<think>I need to check the Jina AI blog for their most recent post, which requires up-to-date information. I need to find the latest blog post from Jina AI. I will use a search engine to find the Jina AI blog and then identify the most recent post. Let me search for latest blog post from Jina AI to gather more information. Okay, I've created some queries to find the latest Jina AI blog post. First, a general search for the Jina AI blog updated in the past week. Then, some focused queries on specific Jina AI products like DeepSearch and neural search, checking for updates in the last month. Also, I included queries about embedding models and API updates, again looking at the past month. And I added a query about Elasticsearch integration from the past year. Finally, I've added a query to find any criticisms or limitations of Jina AI, to get a balanced perspective. Let me search for Jina AI Elasticsearch integration, Jina AI criticism limitations, Jina AI deepsearch updates, Jina AI neural search, Jina AI embedding models to gather more information. To accurately answer the user's question about the latest blog post from Jina AI, I need to visit the provided URLs and extract the publication dates and titles of the blog posts. This will allow me to identify the most recent one. I'll start with the most relevant URLs based on the weights assigned during the search action. Let me read https://jina.ai/news/a-practical-guide-to-implementing-deepsearch-deepresearch, https://jina.ai/news/auto-gpt-unmasked-hype-hard-truths-production-pitfalls, https://jinaai.cn/news/a-practical-guide-to-implementing-deepsearch-deepresearch, https://businesswire.com/news/home/20250220781575/en/Elasticsearch-Open-Inference-API-now-Supports-Jina-AI-Embeddings-and-Rerank-Model, https://gurufocus.com/news/2709507/elastic-nv-estc-enhances-elasticsearch-with-jina-ai-integration to gather more information. Content of https://jina.ai/news/a-practical-guide-to-implementing-deepsearch-deepresearch is too long, let me cherry-pick the relevant parts. Content of https://jinaai.cn/news/a-practical-guide-to-implementing-deepsearch-deepresearch is too long, let me cherry-pick the relevant parts. Content of https://jina.ai/news/auto-gpt-unmasked-hype-hard-truths-production-pitfalls is too long, let me cherry-pick the relevant parts. I have found several blog posts and news articles related to Jina AI. I will summarize the most recent information available to answer the user's question. But wait, let me evaluate the answer first. The answer provides a summary of recent blog posts from Jina AI, covering different aspects of their activities. This constitutes a definitive response as it directly addresses the question with specific information. The answer discusses recent blog posts and news from Jina AI. Tech news has a max age of 7 days, and since the blog posts are only a few days old, the answer is still fresh. I am sorry, but the answer is too generic. While it mentions a few blog posts, it doesn't identify the absolute latest one. A perfect answer should pinpoint the most recent blog post with its exact title and, if possible, a direct link. The current answer provides a summary of several recent posts, which isn't precise enough for what I'm looking for. I messed up by summarizing multiple blog posts instead of pinpointing the single latest one. I needed to focus on finding the most recent date and title. I should prioritize identifying the latest date associated with a blog post and then provide its title and a direct link if available. Okay, I need to find the absolute latest blog post from Jina AI. The previous answer was too generic. I need to be laser-focused on identifying the most recent post. I'll revisit the Jina AI news page and look for specific dates and titles. I'll prioritize URLs that are likely to contain blog posts or news announcements directly from Jina AI. Let me read https://jina.ai/news, https://jina.ai/deepsearch, https://zilliz.com/blog/training-text-embeddings-with-jina-ai, https://github.com/jina-ai/node-DeepResearch, https://x.com/jinaai_?lang=en to gather more information. Content of https://zilliz.com/blog/training-text-embeddings-with-jina-ai is too long, let me cherry-pick the relevant parts. Content of https://jina.ai/deepsearch is too long, let me cherry-pick the relevant parts. I have reviewed my knowledge and can confidently answer the user's question about the latest blog post from Jina AI. I will provide the title and a direct link. But wait, let me evaluate the answer first. The answer provides a clear and direct response to the question, including the title, publication date, and a link to the latest blog post from Jina AI. There are no uncertainty markers or hedging. The blog post was published on April 16, 2025, which is 8 days ago from today (April 24, 2025). Since the blog post falls under 'Tech News,' the maximum age should be 7 days. Therefore, the answer is outdated. Okay, I jumped the gun and didn't double-check the date of the blog post against the current date. My bad for not ensuring it was within the acceptable timeframe! Next time, I'll make absolutely sure to verify the publication date and confirm it's fresh enough before confidently declaring it the latest blog post. Gotta keep those dates in check! I need to find the very latest blog post from Jina AI. The previous attempt failed because it wasn't recent enough. I need to revisit the Jina AI news page to check for any even more recent posts. I'll focus on extracting the title and URL of the most recent entry. Let me read https://jina.ai/news?tag=tech-blog, https://news.ycombinator.com/item?id=38020109, https://github.com/sthagen/jina-ai-jina, https://parsers.vc/news/250222-the-new-frontier-of-ai--elasticsearch-and, https://jina.ai/embeddings to gather more information. Content of https://jina.ai/embeddings is too long, let me cherry-pick the relevant parts. Content of https://news.ycombinator.com/item?id=38020109 is too long, let me cherry-pick the relevant parts. I have gathered information from various sources about Jina AI's blog posts. I will now synthesize this information to provide the most recent blog post title and a direct link, if available. But wait, let me evaluate the answer first. The answer makes a direct statement about the latest blog post from Jina AI, providing the title, publication date, and a link to the post. There are no hedges or qualifications, so it is definitive. Let me finalize the answer. Let Let me cross-reference the information from the web to verify the answer. </think>

The relentless pursuit of better search demands we confront a harsh reality: size matters, and not always in a good way. Jina AI's latest blog post, "On the Size Bias of Text Embeddings and Its Impact in Search," published on April 16, 2025, tackles this head-on. It's not just another piece of content; it's a critical examination of how the length of text inputs can skew similarity metrics, leading search systems to favor verbose, often irrelevant documents over concise, precise matches.

Why should you care? Because in the age of information overload, relevance is king. We're drowning in data, and search engines are our life rafts. But if those rafts are steered by algorithms that are easily fooled by sheer volume, we're all going down with the ship.

The post likely delves into the mechanics of text embeddings, those numerical representations of text that allow machines to understand and compare semantic meaning. The core issue, as Jina AI points out, is that these embeddings can be influenced by the length of the input text, a phenomenon they term "size bias." This means that a longer document, even if only marginally relevant, might appear more similar to a query than a shorter, more focused one.[^1]

To truly grasp the implications, consider the following:

*   **What is Size Bias?** Size bias refers to how the length of text inputs affects similarity, regardless of semantic relevance. It explains why search systems sometimes return long, barely-relevant documents instead of shorter, more precise matches to your query.[^2]
*   **Who is impacted?** Anyone relying on semantic search, from researchers sifting through academic papers to businesses trying to surface the most pertinent information for their customers, is vulnerable to the distortions caused by size bias.
*   **Where does this problem manifest?** This issue isn't confined to a specific search engine or platform. It's a systemic challenge inherent in the way many text embedding models are designed and implemented.
*   **When did this become a pressing concern?** As context windows grow, and models are ingesting larger and larger documents, the problem of size bias becomes amplified.
*   **Why does this happen?** The reasons are complex, but it boils down to the mathematical properties of high-dimensional spaces and the way similarity is calculated. Longer vectors simply have more "surface area" to overlap with a query vector, even if the semantic alignment is weak.
*   **How can we fix it?** Jina AI's blog post likely explores potential mitigation strategies. These might include normalization techniques, architectural modifications to embedding models, or novel similarity metrics that are less susceptible to length-related distortions.

Jina AI's work here isn't just academic; it's a practical intervention. By identifying and analyzing size bias, they're paving the way for more accurate and reliable search technologies. This has real-world implications, influencing everything from information retrieval to content recommendation and beyond.

The latest blog post can be found here: https://jina.ai/news

Ultimately, Jina AI's willingness to confront the inconvenient truths about text embeddings is a testament to their commitment to advancing the field. It's a reminder that progress isn't just about building bigger and more complex models; it's about understanding the nuances and limitations of those models and striving for solutions that prioritize accuracy and relevance above all else. And that's a size-independent truth worth embracing.



[^1]: Size bias refers to how the length of text inputs affects similarity regardless of semantic relevance It explains why search systems sometimes return long barely relevant documents instead of shorter more precise matches to your query [Newsroom - Jina AI](https://jina.ai/news)

[^2]: Size bias refers to how the length of text inputs affects similarity regardless of semantic relevance It explains why search systems sometimes return long barely relevant documents instead of shorter more precise matches to your query [Newsroom - Jina AI](https://jina.ai/news?tag=tech-blog)
Stream finished.
```

## Recherche web (Search)

Basé sur le `s.jina.ai` de Jina AI : transmettez une requête et obtenez le corps de texte propre de la page de résultats du moteur de recherche (SERP), prêt à être fourni directement à un LLM pour des questions-réponses connectées au web et du RAG. L'endpoint prend en charge à la fois `GET` et `POST`.

<Note>
  **Format de réponse (Markdown par défaut)** : par défaut, renvoie une liste de résultats en **Markdown** concaténée, prête à être fournie à un LLM ; lorsque vous avez besoin de données structurées (`title` / `url` / `content` et `usage` de chaque résultat), ajoutez l'en-tête de requête `Accept: application/json` pour obtenir du JSON à la place.
</Note>

### Request Parameters

<ParamField query="q" type="string" required>
  Texte de la requête. Doit être encodé en URL lors de l'appel depuis du code.
</ParamField>

<ParamField query="num" type="integer" default="5">
  Nombre maximal de résultats à renvoyer ; le nombre réel dépend des résultats disponibles.
</ParamField>

<ParamField query="gl" type="string">
  Code pays / région, p. ex. `US`.
</ParamField>

<ParamField query="hl" type="string">
  Langue de l'interface, p. ex. `en`.
</ParamField>

<ParamField query="site" type="string">
  Restreint la recherche à des sites spécifiques ; peut être transmis plusieurs fois, p. ex. `site=jina.ai&site=github.com`.
</ParamField>

<ParamField header="X-Respond-With" type="string" default="markdown">
  Format du corps des résultats, l'un de `markdown` / `html` / `text`.
</ParamField>

<ParamField header="X-Retain-Images" type="string">
  Politique de conservation des images ; transmettez `none` pour supprimer les images et économiser des tokens.
</ParamField>

<ParamField header="X-No-Cache" type="boolean">
  Ignore le cache et récupère les résultats les plus récents.
</ParamField>

De plus, la recherche appelle le Reader pour extraire le corps de chaque résultat ; par conséquent, tous les en-têtes de requête `X-*` contrôlant le formatage du corps listés dans « Lecteur web (Reader) » s'appliquent également aux résultats de recherche.

### Example of Calling

La requête et les paramètres peuvent être transmis en tant que paramètres de requête d'URL via `GET` (recommandé, le plus concis), ou dans un corps de requête JSON via `POST` ; les deux atteignent le même endpoint et renvoient le même résultat. Les exemples ci-dessous ajoutent `Accept: application/json` pour renvoyer du JSON par défaut ; **supprimez cet en-tête pour obtenir une liste de résultats en Markdown propre** (voir le premier exemple `Curl-markdown`).

<CodeGroup>
  ```shell Curl-markdown theme={null}
  # Sans l'en-tête Accept → renvoie une liste de résultats en Markdown concaténée
  curl "https://aihubmix.com/v1/jina/search?q=AIHubMix&num=5&gl=US&hl=en" \
    -H "Authorization: Bearer sk-***"
  ```

  ```shell Curl-GET theme={null}
  curl "https://aihubmix.com/v1/jina/search?q=AIHubMix&num=5&gl=US&hl=en" \
    -H "Authorization: Bearer sk-***" \
    -H "Accept: application/json"
  ```

  ```shell Curl-POST theme={null}
  curl -X POST "https://aihubmix.com/v1/jina/search" \
    -H "Authorization: Bearer sk-***" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -d '{
      "q": "AIHubMix",
      "num": 5,
      "gl": "US",
      "hl": "en"
    }'
  ```

  ```py Python theme={null}
  import requests

  url = 'https://aihubmix.com/v1/jina/search'
  headers = {
      'Authorization': 'Bearer sk-***',  # Remplacez par votre clé AiHubMix
      'Accept': 'application/json'
  }
  params = {'q': 'AIHubMix', 'num': 5, 'gl': 'US', 'hl': 'en'}

  response = requests.get(url, headers=headers, params=params)
  print(response.json())
  ```

  ```ts TypeScript theme={null}
  const url = 'https://aihubmix.com/v1/jina/search?q=AIHubMix&num=5&gl=US&hl=en';

  fetch(url, {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer sk-***', // Remplacez par votre clé AiHubMix
      'Accept': 'application/json'
    }
  })
    .then(res => res.json())
    .then(data => console.log(data))
    .catch(err => console.error(err));
  ```
</CodeGroup>

### Response Description

**Par défaut (sans `Accept`), renvoie une liste Markdown concaténée**, où chaque entrée indique successivement le titre, le lien source, la description (le cas échéant) et le corps :

```text theme={null}
[1] Title: AIHubMix - One Interface, Router All LLMs
[1] URL Source: https://aihubmix.com/?lang=en
[1] Description: Access every major LLM through a single, unified interface. Connect to ChatGPT, Claude, Gemini, DeepSeek and more.
[1] Content:
If requests to http://aihubmix.com fail, you can try using a VPN, or switch to the alternative baseURL: https://api.inferera.com …

[2] Title: AI Models & Pricing - AIHubMix
[2] URL Source: https://aihubmix.com/models?lang=en
[2] Content:
…
```

**Avec `Accept: application/json`, renvoie du JSON structuré** :

```json theme={null}
{
  "code": 200,
  "status": 200,
  "data": [
    {
      "title": "AIHubMix - One Interface, Router All LLMs",
      "url": "https://aihubmix.com/?lang=en",
      "content": "If requests to http://aihubmix.com fail, you can try using a VPN, or switch to the alternative …",
      "usage": { "tokens": 4244 }
    },
    {
      "title": "AI Models & Pricing - AIHubMix",
      "url": "https://aihubmix.com/models?lang=en",
      "content": "…",
      "usage": { "tokens": 4303 }
    }
  ]
}
```

* `data` : tableau des résultats de recherche (le nombre est contrôlé par `num` ; l'exemple ci-dessus renvoie 5 mais seuls les 2 premiers sont montrés ici ; `content` est le corps complet, tronqué dans l'exemple), chacun contenant `title`, `url`, `content`, `usage.tokens`.
* **Facturation** : facturé selon la somme des `usage.tokens` de chaque résultat ; Jina facture officiellement un minimum de **10000 tokens** par recherche, de sorte que le montant final est le plus grand des deux, soit `max(10000, somme des tokens)`.

## Lecteur web (Reader)

Basé sur le `r.jina.ai` de Jina AI : transmettez n'importe quelle URL et obtenez le corps Markdown propre de cette page après conversion, pratique pour extraire du contenu web à fournir à un LLM. Outre les pages web, il prend aussi en charge l'analyse d'**images** (décrites par un modèle de vision) et de **fichiers locaux** (PDF, Word / Excel / PPT, HTML, images).

<Note>
  **Format de réponse (Markdown par défaut)** : par défaut, renvoie directement le **corps Markdown propre**, prêt à être fourni à un LLM ; lorsque vous avez besoin de **JSON** structuré avec `usage` et des champs comme `title` / `url` (le corps se trouve dans `data.content`), ajoutez l'en-tête de requête `Accept: application/json`.
</Note>

### Request Parameters

<ParamField path="URL cible" type="string" required>
  L'adresse web à lire, ajoutée directement à la fin du chemin de l'endpoint, p. ex. `/v1/jina/reader/https://jina.ai`.
</ParamField>

<ParamField body="file" type="file">
  Le fichier local à téléverser ; prend en charge PDF, Word / Excel / PPT, HTML, images, transmis dans le champ `file` via `POST` en tant que `multipart/form-data`.
</ParamField>

<ParamField body="url" type="string">
  Obligatoire lors du téléversement d'un fichier HTML, utilisé comme adresse de référence pour résoudre les liens relatifs de la page ; inutile lors du téléversement d'un PDF.
</ParamField>

<ParamField header="X-Respond-With" type="string" default="markdown">
  Format de retour, l'un de `markdown` / `html` / `text` / `screenshot` / `pageshot`.
</ParamField>

<ParamField header="X-Retain-Images" type="string" default="all">
  Politique de conservation des images, l'une de `all` / `none` (supprimer les images pour économiser des tokens) / `alt`.
</ParamField>

<ParamField header="X-Retain-Links" type="string" default="all">
  Politique de conservation des liens, l'une de `all` / `none` / `text`.
</ParamField>

<ParamField header="X-With-Generated-Alt" type="boolean">
  Génère automatiquement un texte descriptif pour les images sans `alt`.
</ParamField>

<ParamField header="X-With-Links-Summary" type="boolean">
  Résume tous les liens à la fin du corps.
</ParamField>

<ParamField header="X-With-Images-Summary" type="boolean">
  Résume toutes les images à la fin du corps.
</ParamField>

<ParamField header="X-Engine" type="string">
  Moteur d'extraction, l'un de `browser` / `direct` / `cf-browser-rendering`.
</ParamField>

<ParamField header="X-Target-Selector" type="string">
  Sélecteur CSS ; extrait uniquement la région correspondante de la page.
</ParamField>

<ParamField header="X-Remove-Selector" type="string">
  Sélecteur CSS ; supprime les éléments correspondants (p. ex. `header, footer, nav`).
</ParamField>

<ParamField header="X-Timeout" type="integer">
  Délai d'expiration de l'extraction en secondes, max. 180.
</ParamField>

<ParamField header="X-No-Cache" type="boolean">
  Ignore le cache et récupère le contenu le plus récent.
</ParamField>

<ParamField header="X-Md-Heading-Style" type="string" default="atx">
  Style de titres Markdown, l'un de `atx` (`#`) / `setext` (soulignement).
</ParamField>

<ParamField header="X-Md-Bullet-List-Marker" type="string">
  Marqueur de liste à puces Markdown, l'un de `-` / `+` / `*`.
</ParamField>

<ParamField header="X-Md-Hr" type="string">
  Style de ligne horizontale Markdown, p. ex. `***`.
</ParamField>

<ParamField header="X-Md-Link-Style" type="string">
  Style de liens Markdown, l'un de `inlined` / `referenced` / `discarded`.
</ParamField>

Les éléments ci-dessus ne sont que les options courantes. **Tous** les en-têtes de requête `X-*` pris en charge par Jina (y compris toute la famille `X-Md-*`) ainsi que les champs de corps `POST` (comme le script injecté `injectPageScript`) sont **transmis tels quels** par la passerelle ; pour la liste complète et les valeurs, reportez-vous à la [documentation officielle de Jina](https://r.jina.ai/docs).

### Multimodal Input Format

Reader prend en charge trois types d'entrée. **Les pages web et les images** sont ajoutées directement à la fin du chemin de l'endpoint (`GET`) ; **les fichiers locaux** sont téléversés via `POST` en tant que `multipart/form-data`.

#### 1. URL de page web

```text theme={null}
GET /v1/jina/reader/https://example.com
```

#### 2. URL d'image (renvoie une description visuelle)

L'adresse de l'image est également ajoutée à la fin du chemin. Reader utilise un modèle de vision pour générer une **description** (une légende, pas un OCR mot à mot) de l'image et la place dans `content`.

```text theme={null}
GET /v1/jina/reader/https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png
```

#### 3. Téléverser un fichier local (PDF / Word·Excel·PPT / HTML / image)

```text theme={null}
POST /v1/jina/reader
Content-Type: multipart/form-data

file=@./doc.pdf              # placez le fichier dans le champ file
url=https://example.com/...  # nécessaire uniquement pour le téléversement de HTML, comme adresse de référence pour résoudre les liens relatifs
```

### Example of Calling

Par défaut, renvoie directement le corps Markdown ; ajoutez `Accept: application/json` pour obtenir du JSON structuré. Les paramètres optionnels sont transmis en tant qu'en-têtes de requête `X-*` et sont **tous transmis tels quels** par la passerelle à Jina (pour la liste complète, voir « Request Parameters » ci-dessus).

#### 1. Lire une page web

<CodeGroup>
  ```shell Basique (Markdown) theme={null}
  # Sans Accept → renvoie directement le corps Markdown propre
  curl "https://aihubmix.com/v1/jina/reader/https://example.com" \
    -H "Authorization: Bearer sk-***"
  ```

  ```shell Avancé (plusieurs paramètres) theme={null}
  # Combine plusieurs en-têtes X-*, tous transmis tels quels par la passerelle à Jina :
  #   supprimer les images pour économiser des tokens · extraire uniquement la région #bodyContent · résumer les liens à la fin
  curl "https://aihubmix.com/v1/jina/reader/https://en.wikipedia.org/wiki/Large_language_model" \
    -H "Authorization: Bearer sk-***" \
    -H "Accept: application/json" \
    -H "X-Retain-Images: none" \
    -H "X-Target-Selector: #bodyContent" \
    -H "X-With-Links-Summary: true"
  ```

  ```shell JSON theme={null}
  curl "https://aihubmix.com/v1/jina/reader/https://example.com" \
    -H "Authorization: Bearer sk-***" \
    -H "Accept: application/json"
  ```

  ```py Python theme={null}
  import requests

  url = 'https://aihubmix.com/v1/jina/reader/https://example.com'
  headers = {
      'Authorization': 'Bearer sk-***',  # Remplacez par votre clé AiHubMix
      'Accept': 'application/json'
  }

  response = requests.get(url, headers=headers)
  print(response.json())
  ```

  ```ts TypeScript theme={null}
  const url = 'https://aihubmix.com/v1/jina/reader/https://example.com';

  fetch(url, {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer sk-***', // Remplacez par votre clé AiHubMix
      'Accept': 'application/json'
    }
  })
    .then(res => res.json())
    .then(data => console.log(data))
    .catch(err => console.error(err));
  ```
</CodeGroup>

#### 2. Lire une image

```shell Curl theme={null}
curl "https://aihubmix.com/v1/jina/reader/https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" \
  -H "Authorization: Bearer sk-***" \
  -H "Accept: application/json"
```

#### 3. Téléverser un fichier local

Téléversez via `POST` + `multipart/form-data` ; lors du téléversement de **HTML**, vous devez également inclure le champ `url` comme adresse de référence. La facturation est identique à la lecture d'une URL.

<CodeGroup>
  ```shell PDF / Image / Office theme={null}
  curl -X POST "https://aihubmix.com/v1/jina/reader" \
    -H "Authorization: Bearer sk-***" \
    -H "Accept: application/json" \
    -F "file=@./doc.pdf"
  ```

  ```shell HTML (url requis) theme={null}
  curl -X POST "https://aihubmix.com/v1/jina/reader" \
    -H "Authorization: Bearer sk-***" \
    -H "Accept: application/json" \
    -F "file=@./local.html" \
    -F "url=https://example.com/local.html"
  ```
</CodeGroup>

### Response Description

**Par défaut (sans `Accept`), renvoie directement le corps Markdown** (c'est-à-dire le contenu de `data.content` dans le JSON ci-dessous). Par exemple, en lisant `https://example.com` :

```text theme={null}
This domain is for use in documentation examples without needing permission. Avoid use in operations.

[Learn more](https://iana.org/domains/example)
```

**Avec `Accept: application/json`**, renvoie du JSON structuré. La structure du JSON est identique pour les trois types d'entrée : `data` est un objet unique contenant `title` / `url` / `content` / `usage.tokens`. Ci-dessous, les **réponses réelles** pour les trois types d'entrée (lorsque `content` est trop long, le début est conservé et le reste est abrégé par `…`).

**① Lire une page web** (lecture de `https://example.com`) :

```json theme={null}
{
  "code": 200,
  "status": 20000,
  "data": {
    "title": "Example Domain",
    "url": "https://example.com/",
    "content": "This domain is for use in documentation examples without needing permission. Avoid use in operations.\n\n[Learn more](https://iana.org/domains/example)",
    "usage": { "tokens": 29 }
  }
}
```

**② Lire une image** (`content` est la description générée par le modèle de vision) :

```json theme={null}
{
  "code": 200,
  "status": 20000,
  "data": {
    "title": "googlelogo_color_272x92dp.png",
    "url": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png",
    "content": "The logo for Google, consisting of the word Google in lowercase letters, with its colors being blue, red, yellow, and green, representing the company's innovative approach to information and computing services",
    "usage": { "tokens": 38 }
  }
}
```

**③ Téléverser un fichier local** (téléversement d'un article PDF ; `content` est long, seul le début est montré) :

```json theme={null}
{
  "code": 200,
  "status": 20000,
  "data": {
    "title": "Unnoticeable Backdoor Attacks on Graph Neural Networks",
    "url": "blob:df586d587956e0ca72e50e9e12dc06fc44b7c4b480b8a640a6db7d6f488a7c91",
    "content": "# Unnoticeable Backdoor Attacks on Graph Neural Networks\n\n# Enyan Dai ∗\n\nemd5759@psu.edu\n\nThe Pennsylvania State University\n\nState College, USA\n\n## ABSTRACT\n\nGraph Neural Networks (GNNs) have achieved promising results in various tasks such as node classification and graph classification. …",
    "usage": { "tokens": 20535 }
  }
}
```

* `status` : le code de statut métier renvoyé par Jina en amont ; lors d'un appel reader réussi, il vaut `20000` (cohérent avec le HTTP `200` externe).
* **Facturation** : facturé selon `data.usage.tokens` (le nombre réel de tokens de sortie), **sans montant minimum** (contrairement au « minimum de 10000 tokens par recherche » de la recherche) ; pour un contenu extrêmement court, une unité de facturation minimale est appliquée comme plancher, de sorte qu'une facturation nulle ne se produit jamais.

***

Dernière mise à jour : 2026-07-03
