Excessive API billing

ASPOSE WORDS CLOUD API USAGE SYNOPSIS
OVERVIEW
A Node.js application that uses the Aspose Words Cloud API to generate redlined contract documents with track changes and comments. The system processes legal contract reviews and applies suggested edits to DOCX files.
KEY ASPOSE API COMPONENTS USED

  1. File Operations
    • Upload: UploadFileRequest - Uploads original DOCX files to Aspose cloud storage
    • Download: DownloadFileRequest - Downloads processed documents
    • Files are managed with paths like “original.docx”, “revised.docx”, “redlined.docx”
  2. Text Search and Replacement
    • Search: SearchRequest with pattern matching to locate text in documents
    • Replace: ReplaceTextRequest with ReplaceTextParameters for text modifications
    • Applies various edit operations: replace, delete, insert_before, insert_after
  3. Document Comparison
    • Compare: CompareDocumentRequest with CompareData to generate track changes
    • Compares original vs revised documents to create redlined output
    • Uses FileReference.fromRemoteFilePath() for document references
  4. Comment Insertion
    • Insert Comments: InsertCommentRequest with CommentInsert objects
    • Position Targeting: PositionInsideNode with nodeId and offset for precise placement
    • Document Structure: GetParagraphsRequest to retrieve paragraph node IDs
      WORKFLOW PROCESS
  5. Document Upload: Original DOCX uploaded via UploadFileRequest
  6. Text Location: Uses SearchRequest to find specific text excerpts in the document
  7. Text Modifications: Applies edits using ReplaceTextRequest to create revised version
  8. Document Comparison: Uses CompareDocumentRequest to generate track changes between original and revised
  9. Comment Addition: Inserts review comments at specific locations using InsertCommentRequest
  10. Final Download: Retrieves processed document via DownloadFileRequest

For some reason, it used tens of API calls per edit, resulting in billing charges around $600. We only tested the API and never took it to production

@kyletorrington

It seems you are experiencing excessive API billing due to a high number of API calls while using the Aspose Words Cloud API for document processing. Here are a few suggestions to optimize your usage and potentially reduce costs:

  1. Batch Operations: Instead of making multiple API calls for each edit, consider batching your operations. For example, if you are making several text replacements, try to combine them into a single request if possible.

  2. Minimize Document Comparisons: Each comparison operation can be costly. If you are comparing documents frequently, evaluate if you can reduce the number of comparisons or only compare when necessary.

  3. Optimize Comment Insertion: If you are inserting multiple comments, see if you can consolidate them into fewer requests.

  4. Review API Usage: Monitor your API usage to identify which operations are consuming the most calls. This can help you pinpoint areas for optimization.

  5. Testing Environment: Ensure that your testing environment is separate from production to avoid unnecessary charges during testing.

By implementing these strategies, you should be able to reduce the number of API calls and manage your billing more effectively.

If you have specific scenarios or code snippets that you would like to optimize, feel free to share!

Please share your client id