On Apr 15, 2024, OpenAI released their batch API with a 50% cost reduction. Their batch files are pretty convenient ways to bookkeep large number of requests and completions. This short script seeks to make already-constructed OpenAI-style batch files compatible and ingestible for the Anthropic models.
Note: an additional header line is provided in the jsonl which is not given in the original OpenAI batch API. This is configurable.
Currently, only simple synchronous text is supported NOT supported:
- vision
- tools
- streaming
LiteLLM, etc. But external libraries are not used here to keep dependencies minimal.