> For the complete documentation index, see [llms.txt](https://docs.mindee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mindee.com/v2/fr/modeles-de-texte-brut-ocr/sdk-integration/ocr-quick-start.md).

# Démarrage rapide OCR

## Installez la bibliothèque cliente

Installez la bibliothèque cliente Mindee pour le langage ou le framework de votre choix

{% tabs %}
{% tab title="Python" %}
Nécessite Python ≥ 3.9. Python ≥ 3.11 est recommandé.

Installez simplement le [package PyPI](https://pypi.org/project/mindee/) avec `pip`:

```sh
pip install -U mindee~=5.1
```

{% endtab %}

{% tab title="Node.js" %}
Nécessite Node.js ≥ 20.1. Node.js ≥ 22 est recommandé.

Installez simplement le [package NPM](https://www.npmjs.com/package/mindee):

```sh
npm install mindee@^5.5.0
```

{% endtab %}

{% tab title="PHP" %}
Nécessite PHP ≥ 8.1. PHP ≥ 8.3 est recommandé.

Installez simplement le [package Packagist](https://packagist.org/packages/mindee/mindee) avec [composer](https://getcomposer.org/):

```sh
php composer.phar require "mindee/mindee:>=3.0"
```

{% endtab %}

{% tab title="Ruby" %}
Nécessite Ruby ≥ 3.2.

Installez simplement le [gem](https://rubygems.org/gems/mindee) avec :

```shell
gem install mindee -v '~> 5.2'
```

{% endtab %}

{% tab title="Java" %}
Nécessite Java ≥ 11. Java ≥ 17 est recommandé.

ID de groupe : `com.mindee.sdk`\
ID d’artefact : `mindee-api-java`\
Version : `5.2.0` ou supérieur

Il existe plusieurs méthodes d'installation, Maven, Gradle, etc. :

[Détails de l'installation](https://central.sonatype.com/artifact/com.mindee.sdk/mindee-api-java)
{% endtab %}

{% tab title=".NET" %}
.NET ≥ 8.0 est recommandé.

Installez simplement le [package NuGet](https://www.nuget.org/packages/Mindee) avec `dotnet add`:

```sh
dotnet add package Mindee --version 4.4
```

{% endtab %}
{% endtabs %}

Vous ne voyez pas de prise en charge pour votre langage ou framework préféré ? [Faites une demande de fonctionnalité !](https://feedback.mindee.com/?b=682f69c9e2404756e7e68d1c)

## Envoyer un fichier et interroger les résultats

Utilisez la bibliothèque cliente pour envoyer le fichier à votre Modèles OCR et renvoyer le résultat.

{% tabs %}
{% tab title="Python" %}
Nécessite Python ≥ 3.9. Python ≥ 3.11 est recommandé.\
Nécessite le [SDK Python de Mindee](https://pypi.org/project/mindee/) version **4.35.1** ou supérieure.

{% code lineNumbers="true" %}

```python
from mindee import PathInput
from mindee.v2 import (
    Client,
    OCRParameters,
    OCRResponse,
)

input_path = "/path/to/the/file.ext"
api_key = "MY_API_KEY"
model_id = "MY_MODEL_ID"

# Initialisez un nouveau client
mindee_client = Client(api_key)

# Définissez les paramètres OCR bruts
model_params = OCRParameters(
    # ID du modèle, requis.
    model_id=model_id,
)

# Chargez un fichier depuis le disque
input_source = PathInput(input_path)

# Envoyez pour traitement à l’aide du polling
response = mindee_client.enqueue_and_get_result(
    OCRResponse,
    input_source,
    model_params,
)

# Affichez un bref résumé des données analysées
print(response.inference)

# Accédez au résultat OCR
pages: list = response.inference.result.pages
```

{% endcode %}

Consultez également [Résultat OCR](https://docs.mindee.com/ocr-models/sdk-integration/ocr-result) de la documentation.
{% endtab %}

{% tab title="Node.js" %}
Nécessite Node.js ≥ 20.1. Il est recommandé d'utiliser Node.js ≥ 22.\
Nécessite le [SDK Node.js Mindee](https://www.npmjs.com/package/mindee/) version **5.5.0** ou supérieure.

{% code lineNumbers="true" %}

```javascript
import * as mindee from "mindee";
// Si vous utilisez CommonJS :
// const mindee = require("mindee");

const apiKey = "MY_API_KEY";
const filePath = "/path/to/the/file.ext";
const modelId = "MY_MODEL_ID";

// Initialisez un nouveau client
const mindeeClient = new mindee.Client(
  { apiKey: apiKey }
);

// Définissez les paramètres OCR bruts
const modelParams = {
  modelId: modelId,
};

// Chargez un fichier depuis le disque
const inputSource = new mindee.PathInput({ inputPath: filePath });

// Envoyez pour traitement
const response = await mindeeClient.enqueueAndGetResult(
  mindee.product.Ocr,
  inputSource,
  modelParams,
);

// Affichez un résumé sous forme de chaîne
console.log(response.inference.toString());

// Accédez aux pages OCR du résultat
const pages = response.inference.result.pages;
```

{% endcode %}

Consultez également la [Résultat OCR](https://docs.mindee.com/ocr-models/sdk-integration/ocr-result) documentation.
{% endtab %}

{% tab title="PHP" %}
Nécessite PHP ≥ 8.1. PHP ≥ 8.3 est recommandé.\
Nécessite le [SDK PHP Mindee](https://packagist.org/packages/mindee/mindee) version **3.0.0** ou supérieure.

{% code lineNumbers="true" %}

```php
<?php

use Mindee\Input\PathInput;
use Mindee\V2\Client;
use Mindee\V2\Product\Ocr\Params\OcrParameters;
use Mindee\V2\Product\Ocr\OcrResponse;

$apiKey = "MY_API_KEY";
$modelId = "MY_MODEL_ID";
$filePath = "/path/to/the/file.ext";

// Initialiser un nouveau client
$mindeeClient = new Client($apiKey);

// Définir les paramètres OCR bruts
$modelParams = new OcrParameters(
    // ID du modèle, requis.
    $modelId,
);

// Charger un fichier depuis le disque
$inputSource = new PathInput($filePath);

// Envoyer pour traitement à l’aide du polling
$response = $mindeeClient->enqueueAndGetResult(
    OcrResponse::class,
    $inputSource,
    $modelParams
);

// Afficher un résumé de la réponse
echo strval($response->inference);

// Accédez aux résultats de l’OCR
$pages = $response->inference->result->pages;
```

{% endcode %}

Consultez également les [Résultat OCR](https://docs.mindee.com/ocr-models/sdk-integration/ocr-result) documentation.
{% endtab %}

{% tab title="Ruby" %}
Nécessite Ruby ≥ 3.2.\
Nécessite le [Mindee Ruby SDK](https://rubygems.org/gems/mindee) version **5.2.1** ou supérieure.

{% code lineNumbers="true" %}

```ruby
require 'mindee'
require 'mindee/v2/product'

input_path = '/path/to/the/file.ext'
api_key = 'MY_API_KEY'
model_id = 'MY_MODEL_ID'

# Initialiser un nouveau client
mindee_client = Mindee::V2::Client.new(api_key: api_key)

# Définir les paramètres bruts OCR
model_params = {
    # ID du modèle, requis.
    model_id: model_id,
}

# Charger un fichier depuis le disque
input_source = Mindee::Input::Source::PathInputSource.new(input_path)

# Envoyer pour traitement
response = mindee_client.enqueue_and_get_result(
    Mindee::V2::Product::OCR::OCR,
    input_source,
    model_params
)

# Accédez aux pages du résultat OCR
puts response.inference.result.pages
```

{% endcode %}

Consultez également la [Résultat OCR](https://docs.mindee.com/ocr-models/sdk-integration/ocr-result) .
{% endtab %}

{% tab title="Java" %}
Nécessite Java ≥ 11. Java ≥ 17 est recommandé.\
Nécessite le [SDK Java Mindee](https://central.sonatype.com/artifact/com.mindee.sdk/mindee-api-java) version **5.2.0** ou plus.

{% code lineNumbers="true" %}

```java
import com.mindee.input.LocalInputSource;
import com.mindee.v2.MindeeClient;
import com.mindee.v2.product.ocr.OcrResponse;
import com.mindee.v2.product.ocr.params.OcrParameters;
import java.io.IOException;

public class SimpleMindeeClientV2 {

  public static void main(String[] args)
      throws IOException, InterruptedException
  {
    String apiKey = "MY_API_KEY";
    String filePath = "/path/to/the/file.ext";
    String modelId = "MY_MODEL_ID";

    // Initialiser un nouveau client
    var mindeeClient = new MindeeClient(apiKey);

    // Définir les paramètres OCR bruts
    var modelParams = OcrParameters
        // ID du modèle, requis.
        .builder(modelId)
        .build();

    // Charger un fichier depuis le disque
    var inputSource = new LocalInputSource(filePath);

    // Envoyer pour traitement par interrogation
    OcrResponse response = mindeeClient.enqueueAndGetResult(
        OcrResponse.class,
        inputSource,
        modelParams
    );

    // Afficher un résumé de la réponse
    System.out.println(response.getInference().toString());

    // Accéder aux pages du résultat OCR
    var pages = response.getInference().getResult().getPages();
  }
}
```

{% endcode %}

Consultez également la [Résultat OCR](https://docs.mindee.com/ocr-models/sdk-integration/ocr-result) documentation.
{% endtab %}

{% tab title=".NET" %}
.NET ≥ 8.0 est recommandé.\
Nécessite le [SDK .NET de Mindee](https://www.nuget.org/packages/Mindee) version **4.3.0** ou supérieure.

{% code lineNumbers="true" %}

```csharp
using Mindee;
using Mindee.Input;
using Mindee.V2;
using Mindee.V2.Product.Ocr;
using Mindee.V2.Product.Ocr.Params;

string filePath = "/path/to/the/file.ext";
string apiKey = "MY_API_KEY";
string modelId = "MY_MODEL_ID";

// Créez un nouveau client
Client mindeeClient = new Client(apiKey);

// Définir les paramètres OCR bruts
var modelParams = new OcrParameters(
    modelId: modelId
);

// Charger un fichier depuis le disque
var inputSource = new LocalInputSource(filePath);

// Téléversez le fichier
var response = await mindeeClient.EnqueueAndGetResultAsync<OcrResponse>(
    inputSource, modelParams);

// Afficher un résumé de la réponse
System.Console.WriteLine(response.Inference.ToString());

// Accéder aux pages de résultat OCR
var ocrPages = response.Inference.Result.Pages;
```

{% endcode %}

Consultez également les [Résultat OCR](https://docs.mindee.com/ocr-models/sdk-integration/ocr-result) documentation.
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mindee.com/v2/fr/modeles-de-texte-brut-ocr/sdk-integration/ocr-quick-start.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
