Differences Between the CLI and the API
Explain the difference between a CLI and an API, and why they cannot be used interchangeably.
Differences Between the CLI and the API
You may have noticed that we provide both CLI endpoints and API endpoints. This article explains the differences between them and why it’s important to use the right endpoint in the right scenario.
Core differences
The CLI and the API are completely different interfaces.
Although they both call the same model (for example, Gemini), the CLI and the API go through completely different channels:
CLI tools (such as Gemini CLI) → CLI-specific interface → model API calls (such as Cherry Studio) → standard API interface → model
The request format, response format, and parameter structure of these two APIs are completely different.
Why can't they be mixed?
<Callout type="error"> If you use an API endpoint in the CLI tool, or use a CLI endpoint in an API client, it will result in:
- The same model can exhibit different capabilities
- Some features are not working properly
- Encountering strange issues that are hard to troubleshoot
</Callout>
This is because:
Correct usage
CLI endpoint: for developer tools
CLI endpoints should only be used in their corresponding command-line tools:
These tools internally use the correct request format to communicate with the CLI interface.
API endpoint: for general-purpose clients
The API endpoint is used for standard API call scenarios:
price difference
Because the CLI and the API are different channels, their pricing may also differ:
- Different channel costs — Vendors have different pricing strategies for the CLI and the API
- Different quota limits — QPM (queries per minute) and TPM (tokens per minute) may differ
<Callout type="info"> For specific pricing, please refer to the Pricing page. Prices may change based on official adjustments. </Callout>
About Price Changes
The price adjustment is mainly due to the following reasons:
1. Official price adjustments — When Google, Anthropic, or OpenAI change their pricing, we will update ours accordingly
2. Channel cost changes — Some low-cost channels are implemented through methods such as reverse subscriptions. If the providers tighten restrictions, channel costs will rise and prices will need to be adjusted accordingly
<Callout type="info"> Price adjustments are not a subjective decision by the platform, but an honest reflection of changes in upstream costs. We will do our best to keep prices stable, but when costs do rise, adjusting prices is truly unavoidable. </Callout>
FAQ
Q: I used an API endpoint in the Gemini CLI. Why does it feel like the model has become dumber?
Because the API endpoint does not include the programming-optimized prompts that are preconfigured for the CLI interface, the model’s behavior in coding scenarios may differ slightly. Please use the correct CLI endpoint.
Q: Can I use the CLI endpoint for API development?
Not recommended. The request/response format of CLI endpoints is designed for command-line tools, and using it directly for API development will lead to compatibility issues.
Q: Why not just unify everything into a single endpoint?
See Why we don’t do API format conversion. In short, forcing a conversion will lose functionality, change model behavior, and cannot guarantee an experience consistent with the official one.
Q: Will my usage be combined and calculated together?
CLI and API usage are calculated separately, each consuming its own quota. However, your account balance is shared.
Summary
- CLI endpoints → Used only in their respective CLI tools (Claude Code, Gemini CLI, Codex)
- API Endpoints → Used for API call scenarios such as Cherry Studio, custom development, and more
- Do not mix → Mixing will cause abnormal model behavior
Choose the right endpoint to get the best experience.
Related reading
- Why We Don’t Do API Format Conversion — Learn about our design philosophy of keeping native interfaces
- Route Selection — Choose the access route that best suits you