The problem
A team shipped an AI feature on a closed model API, such as ticket summaries, document extraction or drafted replies. It works, but the bill grows with usage, the price is the provider’s to set, and every prompt leaves the company’s environment.
Start with a test set
Most migrations fail on quality problems nobody measured. Sample real requests across customers and request types, including the hard cases, and decide how each response is scored: exact match for extraction, the right label for classification, a rubric for summaries. The current closed model’s score on that set is the bar.
Try large open models first
Run the test set against two or three large open models on serverless endpoints, with the instructions the feature uses today. For many extraction, classification and summarization features, one passes. If it does at a lower cost, switch.
Fine-tune when volume justifies it
A small model fine-tuned with LoRA on one narrow task can match a large general model on that task, at a lower cost per request. Train it on your own inputs with labels from people, or responses that passed review. Some providers' terms restrict training on their outputs, so check before using logged responses.
Price the whole request
Input, cached input and output tokens are priced differently, and open models split text into tokens differently, so measure tokens per request for each option instead of comparing list prices. Serverless suits low or uneven traffic. A dedicated endpoint suits steady volume, and its latency does not depend on anyone else’s traffic.
What to expect
The first result is a table of each candidate’s pass rate, cost per thousand requests and latency at the 95th percentile. Pick the cheapest that passes, move traffic in steps with the closed model as a fallback, and keep the weekly test run going after the switch.