読み込み中...
読み込み中...
OpenOCRを5分で始める。
open-ocr.com/signupで無料アカウントにサインアップします。新規アカウントには開始用のクレジットが含まれます。その後、ダッシュボードからAPIキーを発行してください。
アカウントとAPIキーの作成には人間による操作(CAPTCHA)が必要です。AIエージェントは、ユーザーにsk-ocr-キーを依頼してください。
mistral-mistral-ocr-4-1。推奨のデフォルトエンジンで、複数ページのPDFをネイティブに処理します。google-gemini-3.1-flash-lite。APIキーと画像URLを使って、OCRエンドポイントにPOSTリクエストを送信します。重複処理を防ぐため、すべてのリクエストにIdempotency-Keyヘッダーが必要です:
curl -X POST https://api.open-ocr.com/v1/ocr \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"engine": "mistral-mistral-ocr-4-1",
"input": {
"type": "url",
"url": "https://tesseract-ocr.github.io/tessdoc/images/eurotext.png"
}
}'{
"request_id": "req_abc123",
"status": "succeeded",
"engine": "mistral-mistral-ocr-4-1",
"extracted_text": "INVOICE #12345\nDate: January 15, 2024\n...",
"extracted_text_preview": "INVOICE #12345...",
"cost_debited": 0.005,
"remaining_balance": 0.995,
"provider_latency_ms": 280
}1ページあたりの料金は選択するエンジンによって異なります。最新の料金は料金ページをご覧ください。remaining_balanceフィールドには更新後のクレジット残高が表示されます。
画像はbase64エンコードされたデータとして送信することもできます。ファイルがメモリ上にある場合に便利です:
# Encode a local file and send it
BASE64=$(base64 -w0 receipt.png)
curl -X POST https://api.open-ocr.com/v1/ocr \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"engine": "mistral-mistral-ocr-4-1",
"input": {
"type": "base64",
"data_base64": "'$BASE64'",
"mime_type": "image/png"
}
}'OpenOCRはシンプルなREST + JSON APIです。SDKのインストールは不要で、お使いのHTTPクライアントをそのまま利用できます。
import uuid
import requests
resp = requests.post(
"https://api.open-ocr.com/v1/ocr",
headers={
"Authorization": "Bearer sk-ocr-your-api-key",
"Content-Type": "application/json",
"Idempotency-Key": str(uuid.uuid4()), # new UUID per logical request
},
json={
"engine": "mistral-mistral-ocr-4-1",
"input": {"type": "url", "url": "https://example.com/receipt.png"},
},
)
resp.raise_for_status() # an error envelope has no "status" field
result = resp.json()
if result["status"] != "succeeded":
raise RuntimeError(f"OCR ended as {result['status']}: {result.get('provider_error')}")
print(result["extracted_text"])const resp = await fetch("https://api.open-ocr.com/v1/ocr", {
method: "POST",
headers: {
Authorization: "Bearer sk-ocr-your-api-key",
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID(), // new UUID per logical request
},
body: JSON.stringify({
engine: "mistral-mistral-ocr-4-1",
input: { type: "url", url: "https://example.com/receipt.png" },
}),
});
const result = await resp.json();
if (result.status !== "succeeded") throw new Error("OCR ended as " + (result.status ?? result.error?.code)); // error envelopes have no status
console.log(result.extracted_text);ダッシュボード形式の利用履歴(ページネーションと日付フィルター付き)を取得するにはGET /api/usageを使用してください。Authorizationヘッダーによる認証を使用してください。 クエリパラメータとしてapi_keyを渡す方法は非推奨のフォールバックとしてのみサポートされています。
# Preferred — the API key alone identifies the caller
curl "https://open-ocr.com/api/usage?page=1&per_page=50" -H "Authorization: Bearer sk-ocr-your-api-key"
# Deprecated fallback (migration only; avoid in new clients)
# curl "https://open-ocr.com/api/usage?api_key=sk-ocr-your-api-key"移行に関する注意:URL、ログ、アナリティクスのリファラー、ブラウザ履歴でAPIキーが漏えいするのを防ぐため、既存のクライアントはクエリ認証からヘッダー認証に移行してください。
OpenOCRは複数のOCRエンジンを提供しており、それぞれ異なるユースケースに最適化されています。最適なエンジンを見つけるには、エンジンカタログをご覧いただくか、比較ツールをお読みください。
# List available engines
curl https://api.open-ocr.com/v1/engines \
-H "Authorization: Bearer YOUR_API_KEY"
# Quick guide:
# mistral-mistral-ocr-4-1 — Recommended default: general documents, scans, tables
# google-gemini-3.1-flash-lite — Cheapest acceptable quality
# local-tesseract — OpenOCR-hosted, clean printed text
# local-easyocr — OpenOCR-hosted, multi-language
# local-doctr — OpenOCR-hosted, complex layouts
# openocr-ocrmypdf — OpenOCR-hosted, scanned PDFs with auto-deskew
# openocr-rapidocr — OpenOCR-hosted, lightweightAPIレスポンスにはレート制限に関するヘッダーが含まれます:
X-RateLimit-Limit: 60 # requests per minute
X-RateLimit-Remaining: 59 # requests left in window
X-RateLimit-Reset: 60 # seconds until window resetsデフォルトの上限はAPIキーごとに毎分60リクエストです。上限に達すると429レスポンスが返されます。