Skip to content

feat: add support for OpenAI batch processing - #1479

Merged
diegosouzapw merged 2 commits into
cheaper-inference:release/v3.7.0from
hartmark:feature/openai-batching
Apr 21, 2026
Merged

diegosouzapw merged 2 commits into
cheaper-inference:release/v3.7.0from
hartmark:feature/openai-batching

Conversation

@hartmark

Copy link
Copy Markdown
Contributor

Summary

I've added backend support for OpenAI-compatible batching.

https://developers.openai.com/api/reference/resources/batches/methods/create

Validation

  • npm run lint
  • npm run test:unit
  • npm run test:coverage
  • Coverage is still >= 60% for statements, lines, functions, and branches
  • SonarQube PR analysis is green or any remaining issues are explicitly documented below

Tests Added Or Updated

I've added .http test to test the actual endpoints for the API. I've also added integration and unit-tests.

Coverage Notes

I've added testcases for all affected code and new code

Reviewer Notes

  • This adds just the endpoint, perhaps a opt-in option or option to opt-out?
  • Files are saved in database
  • There is no user-facing UI for the batches, I'm thinking of adding a simple grid to list batches and their statuses, and a grid for files.
  • My goal is to support Mistral AI batching, so next step is to have a check if all models refer to a mistral target it should call the Mistral Batch API.
    https://docs.mistral.ai/api/endpoint/batch

@hartmark
hartmark requested a review from diegosouzapw as a code owner April 21, 2026 13:21

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements a comprehensive batch processing system and file management API, including database migrations, background polling services, and REST endpoints for batch and file operations. It also adds support for persistent API keys via environment variables. Feedback focuses on optimizing database performance by throttling batch updates, improving memory efficiency when handling large file uploads, and fixing potential storage leaks in the cleanup logic. Additionally, it is recommended to handle potential unhandled promise rejections in the asynchronous batch item processing to ensure system stability.

Comment thread open-sse/services/batchProcessor.ts Resolved
Comment thread src/app/api/v1/files/route.ts Resolved
Comment thread open-sse/services/batchProcessor.ts Resolved
Comment thread open-sse/services/batchProcessor.ts Resolved
Comment thread open-sse/services/batchProcessor.ts Resolved
@diegosouzapw
diegosouzapw changed the base branch from main to release/v3.7.0 April 21, 2026 20:12
@diegosouzapw
diegosouzapw merged commit 8bb1c83 into cheaper-inference:release/v3.7.0 Apr 21, 2026
2 checks passed
@diegosouzapw diegosouzapw mentioned this pull request Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants