Choosing a Large Language Model: Closed-Source APIs, Open-Weight Models, and Multimodal Options
Choosing an LLM often comes down to data governance, call budget, and required modality. This article compares closed-source API models, open-weight models, and multimodal image/text tools, then presents an evaluation framework, common mistakes to avoid, and a practical selection process with a model abstraction example.
Before starting model selection, ask three questions: Can your data leave your environment? What is your expected monthly call volume and budget? Do you need text capabilities, image generation, or both? The answers usually narrow the candidate list to one or two model categories. The sections below cover the main technical routes and end with an evaluation framework and practical steps.
Model versions, product names, licenses, and pricing change quickly. Always verify them against each vendor’s current documentation.
Closed-Source API Route
The closed-source API route includes models such as OpenAI’s GPT series, Anthropic’s Claude series, and Google’s Gemini series. These vendors host the models in the cloud, and developers call them through APIs. The model weights are not downloadable.
This route offers strong general reasoning, frequent version updates, and no need to maintain GPU clusters. The trade-off is that business data must be sent to a third-party service. Enterprises should review each vendor’s data retention and training terms, and also accept that pricing and model versions are controlled by the vendor.
This approach is suitable for quickly validating a product idea, for use cases where data egress is not prohibited, and for teams without dedicated model operations staff.
How to Use Open-Weight Models
The open-weight route includes models such as Meta’s Llama series, Alibaba Cloud’s Qwen series, and DeepSeek. Developers can deploy these models on their own servers, continue training or fine-tune them with business data, and use quantization to reduce GPU memory usage.
Open-source code and open weights are two different things. A license determines whether commercial use is allowed, whether there is a maximum user scale, and how derivative models can be licensed. Each model license should be read carefully. Do not assume that a project described as open source is automatically available for commercial use.
A commonly cited example for small model quality is Stanford’s Alpaca, released in 2023. The team fine-tuned Meta’s LLaMA 7B model with about 52,000 instruction examples and, in a small-scale human evaluation, reported performance similar to text-davinci-003. This result shows that instruction data quality can have a large effect on conversational ability. However, the evaluation sample size was limited, so the conclusion cannot be generalized to all tasks. When selecting a model, evaluate it with your own business data.
Choosing Multimodal Generation Tools
For text-to-image generation, Stable Diffusion is the most frequently mentioned open-weight model. It was released by Stability AI in 2022, and the community has built a large ecosystem of fine-tuned models, plugins, and workflow tools around it. Control modules such as ControlNet can constrain image composition and character pose.
Midjourney is available as a closed service through web and app interfaces. OpenAI’s DALL·E series provides closed capabilities through an API. Baidu also offers Wenxin Yige as an image generation product, while the ERNIE model family covers text capabilities. This article classifies products by function and does not rank vendors.
When choosing a multimodal tool, evaluate four areas:
- Does output quality meet your business requirements?
- Is controllability sufficient for composition, style, and text rendering?
- Are image licensing and commercial-use terms clear?
- Can the team accept the learning cost of the surrounding community ecosystem?
Evaluation Framework: Capability, Cost, Compliance, Ecosystem
The table below is a directly usable evaluation framework. The weights are a starting point and should be adjusted according to your business priorities.
| Dimension | Questions to answer | Example weight |
|---|---|---|
| Capability | Accuracy on your internal sample set, inference stability, and sufficient context length | 35% |
| Cost | Monthly API cost based on request volume, or GPU depreciation plus operations labor | 25% |
| Compliance | Does data leave your environment? What are the retention and training terms? Does the license permit the intended use? | 25% |
| Ecosystem | SDKs, deployment tools, community plugins, documentation quality, and vendor responsiveness | 15% |
Common Mistakes to Avoid
First, do not rely only on public leaderboard scores. The distribution of benchmark questions can be very different from your business data, so a high public score does not guarantee good business performance.
Second, do not ignore response latency. The same model can behave differently across regions and concurrency levels. Test it under realistic load before launch.
Third, do not treat open weights as free. Self-hosting requires GPUs, storage, and operations labor. The total cost can be higher than API calls.
Fourth, do not ignore output safety. A model can produce incorrect or non-compliant content, so a separate filtering layer is needed.
Fifth, do not ignore license terms. License restrictions can make a project non-commercial only after it is already built.
Practical Selection Process
- Collect 30 to 50 real business questions into an internal evaluation set. Record accuracy and response time for each candidate model.
- Run small fine-tuning or prompt experiments with an open-weight model on internal data to verify whether the business use case is feasible.
- If the closed-source API is clearly better, evaluate a data-masking or de-identification approach before calling the API.
- Add a model abstraction layer in your application. Encapsulate model calls behind a common interface so you can switch models and run A/B tests.
The following example shows a model abstraction layer with exception handling, retries, and fallback:
import loggingimport timefrom abc import ABC, abstractmethodlogger = logging.getLogger(__name__)class LLMError(Exception):"""Raised when a model call fails. Concrete clients should wrap SDK-specific exceptions in this type."""class LLMClient(ABC):@abstractmethoddef generate(self, prompt: str, timeout: float = 30.0, **kwargs) -> str:"""Call the model and return text. Raise LLMError on timeout or failure."""def answer_question(client: LLMClient,question: str,context: str,max_retries: int = 2,fallback: str = "I'm sorry, I can't answer that right now. Please try again later.",) -> str:if not context.strip() or not question.strip():raise ValueError("context and question must not be empty")prompt = (f"Answer the question based on the following context:\n"f"{context}\n"f"Question: {question}")for attempt in range(max_retries + 1):try:return client.generate(prompt, timeout=30.0)except LLMError as exc:logger.warning("Model call failed, attempt %d: %s", attempt + 1, exc)if attempt < max_retries:time.sleep(2 ** attempt)logger.error("Model call failed after multiple retries; returning fallback text")return fallback
Before going live, add content safety filtering and format validation after the model output. Also adjust timeout and retry parameters based on measured latency, so retries do not amplify request load.
