OLM OCRを強力なREST APIでアプリケーションに統合します。複数のアップロード方法と柔軟な認証をサポート。
アカウントにサインインし、設定ページからAPIキーを生成してください。
設定に移動Base64エンコーディング(小ファイル向け)またはURLアップロード(大ファイル向け)を選択してください。
画像またはPDFをOCR APIに送信すると、構造化されたテキストデータが返されます。
画像とPDFからテキストを抽出
POST https://www.freeolmocr.com/api/ocr/process{
"image": "base64_encoded_image_data",
"options": {
"format": "text" # json, text, markdown
}
}{
"imageUrl": "https://img.freeolmocr.com/mistral-ocr/...",
"options": {
"format": "text" # json, text, markdown
}
}{
"success": true,
"userId": "user_123",
"inputSource": "base64",
"extractedText": "Extracted text content...",
"confidence": 0.95,
"processingTime": 1.2,
"creditsUsed": 1
}リクエストにAPIキーを含める
オプション1:x-api-keyヘッダー
x-api-key: mk_your_api_key_hereオプション2:Authorizationヘッダー
Authorization: Bearer mk_your_api_key_hereAIエージェントとツール用のモデルコンテキストプロトコル
HTTP/JSON-RPCエンドポイント:
POST https://www.freeolmocr.com/api/mcpSSEストリーミングエンドポイント:
GET https://www.freeolmocr.com/api/mcpOCRを使用して、ドキュメントや画像からテキストを抽出します。PDFファイル、JPEG、PNG、WebP画像をサポートしています。base64データとURLの両方を受け入れます(同期処理)
カーソルでMCPツールを使用して、画像からコード分析とドキュメント抽出を行う
MCP設定: cursor_mcp_config.json
{
"mcp": {
"servers": {
"mistral-ocr": {
"url": "https://www.freeolmocr.com/api/mcp",
"transport": "http",
"headers": {
"x-api-key": "mk_your_api_key_here",
"Content-Type": "application/json"
},
"capabilities": { "tools": true }
}
}
},
"shortcuts": {
"ocr": "@mistral-ocr extract_text"
},
"workflows": {
"large_file_ocr": [
"extract_text with public_url"
],
"small_file_ocr": [
"extract_text with base64 data"
]
}
}カーソルでの使用:
@ocrHTTP/SSEエンドポイントを使用して、独自のMCPクライアントを構築するか、他のAIツールと統合します。
汎用クライアント設定: mcp_config.json
{
"mcp": {
"servers": {
"mistral-ocr": {
"url": "https://www.freeolmocr.com/api/mcp",
"transport": "http",
"authentication": {
"type": "api_key",
"header": "x-api-key",
"key": "mk_your_api_key_here"
},
"capabilities": {
"tools": true,
"resources": false,
"prompts": false
},
"metadata": {
"name": "Mistral OCR",
"description": "OCR service for PDF and image text extraction",
"version": "2.0.0"
}
}
}
},
"client": {
"timeout": 30000,
"retries": 3,
"transport_fallback": ["http", "sse"]
}
}HTTPクライアントの例:
// Initialize MCP connection
const response = await fetch('https://www.freeolmocr.com/api/mcp', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': 'mk_your_api_key'
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'initialize',
params: {
protocolVersion: '2024-11-05',
capabilities: { tools: {} }
}
})
});SSEクライアントの例:
// Connect to SSE endpoint
const eventSource = new EventSource(
'https://www.freeolmocr.com/api/mcp?' +
'api_key=mk_your_api_key'
);
eventSource.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log('Received:', data);
};すべてのMCPリクエストには、これらのいずれかの方法を使用したAPIキー認証が必要です:
x-api-key: mk_your_api_key (ヘッダー)Authorization: Bearer mk_your_api_key (ヘッダー)FETCH_MCP_SERVER_API_KEY=mk_your_api_key (環境変数)curl -X POST https://www.freeolmocr.com/api/mcp \
-H "Content-Type: application/json" \
-H "x-api-key: mk_your_api_key" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}'curl -N -H "Accept: text/event-stream" \
-H "x-api-key: mk_your_api_key" \
https://www.freeolmocr.com/api/mcpすぐに使えるコードスニペット
import requests
import base64
# Base64 method
with open('image.jpg', 'rb') as f:
image_data = base64.b64encode(f.read()).decode()
response = requests.post(
'https://www.freeolmocr.com/api/ocr/process',
headers={'x-api-key': 'mk_your_api_key'},
json={'image': image_data}
)
result = response.json()
print(result['extractedText'])# Base64 method
IMAGE_DATA=$(base64 -i image.jpg)
curl -X POST https://www.freeolmocr.com/api/ocr/process \
-H "x-api-key: mk_your_api_key" \
-H "Content-Type: application/json" \
-d "{\"image\": \"$IMAGE_DATA\"}"