---
title: "Custom API in AI Desktop Clients: 5 Settings, 4 Common Mistakes"
description: "Use an LLM in a desktop AI client with no code. Covers API format, Base URL, API Key, model name and context count, plus an error-code lookup table."
url: https://cdnping.org/en/blog/cherry-studio-add-model-provider-beginner
language: en
published: 2026-12-01
category: "Developer tools"
tags: ["AI client","custom API","Cherry Studio","Chatbox","beginner guide"]
source: cdnping.org
license: Free to quote and summarize with a link to the url above.
---
# Custom API in AI Desktop Clients: 5 Settings, 4 Common Mistakes

To use a custom API in a desktop AI client, you only need to fill in five things: the API type, the endpoint address (Base URL), the API Key, the model name, and the context message count. If any of the first four is wrong, the request either never gets sent or comes back with an error such as 401 or 404. The last one won't produce an error, but it directly affects your bill. You don't need to write code or know programming.

Clients like Cherry Studio and Chatbox are essentially a "request sender" with a GUI: you enter a service address and a key, and the client sends your chat in a fixed format and displays the reply. Interfaces differ, and setting names vary a little. For exact menu locations, check each client's own documentation. What follows covers the parts they all share.

## What do the five settings mean?

| Setting | Common names | What to enter |
| --- | --- | --- |
| API type | Provider type, Provider, API format | The compatible format named in the provider's docs, such as OpenAI-compatible or Anthropic format |
| Endpoint address | Base URL, API URL, Endpoint | The address the provider gives you, usually starting with `https://` |
| API Key | Secret key, token | A string you create in the provider's console; treat it like a password |
| Model name | Model, model ID | The model identifier listed in the provider's docs, entered exactly as written |
| Context message count | Context count, history messages | How many earlier messages to include with each request |

The API type decides which format the client uses to build the request. If you pick the wrong type, getting the other three right won't help. If the provider supports both formats, choose the one your client supports more completely.

## Which settings do beginners get wrong most often?

### Endpoint address: one segment too many or too few

This is where most problems happen. Some clients automatically append a path such as `/chat/completions` to the address you enter, and some don't. There are three common mistakes:

1. You enter the full request path as the Base URL, the client appends the path again, the path is duplicated, and you get a 404.
2. You leave out the version segment (for example, the provider requires the address to end in `/v1` and you entered only the domain), which also returns a 404.
3. The address has a trailing space, or you picked up curly quotes when copying.

To check, look at the curl example in the provider's docs. The Base URL is the full request address in that example with the final endpoint path removed. Exact formats are defined by the provider's docs and the client's hint text. Editors such as Cursor also limit where a Base URL applies; see [Cursor custom API setup: where Base URL applies and what to check when it doesn't work](/en/blog/cursor-override-openai-base-url).

### API Key: copied incompletely, or sent to the wrong person

It is easy to miss a few characters at the start or end when copying. A space before or after the key will also cause a 401. After filling it in, send a quick "hello" to verify.

Also note that a key is the same as a password. Don't post a screenshot of it in a group chat, and don't commit it to a public repository. If it leaks, revoke it in the provider's console first, then check usage. The steps are in [OpenAI API key leaked: revoke it immediately, check usage, prevent a repeat](/en/blog/openai-api-key-leaked-response).

### Model name: looks right, but isn't

The model name must match the identifier in the provider's docs, including capitalization, hyphens and date suffixes. The "friendly name" shown in the client's UI is not necessarily the ID actually sent in the request. If the client has a "fetch model list" button, use it first; if not, copy the name from the provider's docs. A wrong model name usually returns 404 or 400, and the error message typically says something like "model does not exist."

### Context message count: set too high, and costs creep up

LLM APIs have no "memory." Every request has to carry the earlier chat history with it, so the longer the history, the more tokens each request consumes. If you set the context count to "unlimited," then later in a long conversation every question makes you pay again for everything said before.

For casual chat, keeping the last several to a dozen or so messages is usually enough. Raise it temporarily when you need to analyze a long document. There is no universal recommended value for this setting; a few trial runs with your own usage will show what works.

## How do you verify the setup? Follow this order

1. Confirm that the API type, address, Key and model name are all saved, with no stray spaces.
2. Start a new empty chat and send only "hello," with no files or images attached.
3. If you get a reply, the basic path works.
4. If you don't, use the error table below to troubleshoot.
5. Once replies work, test long text, images and other features. Not every model supports image input, so check the model's documentation.

## Got an error? Check by status code

| Symptom | Likely cause | Check first |
| --- | --- | --- |
| 401 | Key is wrong, expired or revoked | Copy the Key again; confirm it belongs to this provider |
| 403 | No permission for that model, or your region isn't supported | Permissions in the provider's console and the supported regions in its docs |
| 404 | Wrong address path or model name | Whether the Base URL has an extra or missing segment; whether the model name matches |
| 429 | Too many requests, or quota used up | The quota and rate-limit notes in the console |
| 5xx | Server-side problem | Retry later; check the provider's status page |
| Timeout, endless spinner | Network unreachable or unstable service | Retry at a different time; see below |

The exact meaning of each status code is defined in each provider's official documentation. To bypass the client and find out whether the problem is the client or the service itself, you can send a request directly from the command line; see [Send your first LLM request with curl: every parameter explained](/en/blog/curl-first-chat-completions-request). If you are new to APIs, you can also start with [Your first AI API call: send a request with curl](/en/blog/first-ai-api-call-tutorial).

## It keeps timing out: is it my configuration or the network?

First tell the two cases apart. A configuration error usually returns a clear error code quickly, such as 401 or 404. A network problem shows up as a long wait with no response, or as intermittent failures.

If it's the latter, use the [cdnping online speed test](/en) to measure initial connection and round-trip time to each model API from your browser, then check the [API status page](/en/status) to see whether the provider is having problems. For the causes of latency and how to judge it, see [Why AI API latency is high from mainland China](/en/learn/ai-api-latency-china).

## If you'd rather not register with each provider, what are the options?

Registering for official APIs yourself means creating an account with each provider, topping up separately, and managing several keys. The alternative is an aggregation gateway, where one address and one key give you access to many models.

AGI Plan is one such service. It is a monthly subscription billed in RMB, with no overseas credit card needed. It is compatible with both the OpenAI and Anthropic API formats, so any client from the discussion above that lets you enter an "endpoint address + API Key" can use it, and Cherry Studio is one of them. It is not an officially authorized channel, and some models are marked "overseas only"; which models you can use is determined by the [models page](https://agiplan.dev/models). AGI Plan is a commercial partner of cdnping. Setup takes three steps: sign up with an emailed verification code, choose a plan and create a key, and change one setting in your client.

Whether pay-as-you-go or a monthly plan suits you depends on how much you chat; see [Which plan for Cherry Studio: pay-as-you-go or monthly, by chat volume](/en/blog/cherry-studio-which-plan). There is also an article on similar settings: [Custom API endpoints for Claude Code, Codex and OpenCode](/en/blog/configure-custom-api-endpoint-claude-code-codex).

## What to do next

1. Pick a client, fill in the five settings above, and verify with "hello."
2. Start with a small context count, use it for a few days, then adjust.
3. If you hit an error, check the status-code table first, then reproduce it with curl.
4. To see how to set up AGI Plan, read the [beginner guide](https://agiplan.dev/startup).
