The problem: Opposing counsel sent you 500 pages of blurry photocopies. You need to search them, but they’re just images.The solution: Run OCR to extract text, then search or analyze with AI.
import Casedev from 'casedev';const client = new Casedev({ apiKey: process.env.CASEDEV_API_KEY });// Process a document uploaded by your userconst job = await client.ocr.v1.process({ document_url: documentUrl, // URL from your user's upload engine: 'doctr', // Fast, good for printed text features: { embed: {} // Generate searchable PDF }});console.log(`OCR job started: ${job.id}`);
Provide extracted text, structured data, or a searchable PDF:
// Download plain text for your userconst text = await client.ocr.v1.download(job.id, 'text');// Download searchable PDF (original with invisible text layer)const pdf = await client.ocr.v1.download(job.id, 'pdf');fs.writeFileSync('searchable-document.pdf', Buffer.from(pdf));// Download structured JSON (with word coordinates for highlighting)const json = await client.ocr.v1.download(job.id, 'json');console.log(`Extracted ${json.pages.length} pages`);
Enhance your feature with automatic data extraction:
// Extract key information for your userconst analysis = await client.llm.v1.chat.createCompletion({ model: 'anthropic/claude-sonnet-4.5', messages: [ { role: 'system', content: 'Extract key dates, parties, and claims from this document. Format as JSON.' }, { role: 'user', content: text } ], temperature: 0 // Deterministic for factual extraction});// Return structured data to your userconsole.log(analysis.choices[0].message.content);