A zero-dependency TypeScript client for LlamaIndex PDF parsing API. Convert PDF documents to markdown with ease.
pnpm install llama-parse
import { LlamaParse } from 'llama-parse';
// Initialize the client
const parser = new LlamaParse({
apiKey: 'your-api-key'
});
// Parse a PDF file
const file = new File(['...'], 'document.pdf', { type: 'application/pdf' });
const result = await parser.parseFile(file);
console.log(result.markdown);
LlamaParseinterface LlamaParseConfig {
apiKey: string; // Required: Your LlamaIndex API key
baseUrl?: string; // Optional: Custom API endpoint
headers?: HeadersInit; // Optional: Additional headers
}
parseFile(file: File | Blob): Promise<MarkdownResult>
uploadFile(file: File | Blob): Promise<string>
checkStatus(jobId: string): Promise<JobStatus>
getMarkdownResult(jobId: string): Promise<MarkdownResult>
interface MarkdownResult {
markdown: string;
job_metadata: {
credits_used: number;
job_credits_usage: number;
job_pages: number;
job_auto_mode_triggered_pages: number;
job_is_cache_hit: boolean;
credits_max: number;
};
}
MIT
Contributions are welcome! Please feel free to submit a Pull Request.