Skip to content
XXD VPS Guide
中文
Main guide · step 6 of 715 minutes

Use your own AI API

You need: The login-info file; your own AI accountWhat CLIProxyAPI is, adding accounts, connecting tools

What this step is

Your server already runs CLIProxyAPI: it turns your own AI accounts (such as ChatGPT or Claude) into a standard API for all kinds of AI tools. It starts empty; this step adds your accounts.

This step is optional. If you only want the line, skip ahead to step 7.

What it can and can't do

Can: let Cherry Studio, coding tools and your own programs all use your AI account through one address. Can’t: create quota out of thin air. It still uses your account’s own quota and costs.

1. Log in to the management center

Open the login-info file and find the “CLIProxyAPI” section:

Item in the file Used for
Management center The admin page to open in a browser
Management center login key Logging in to the admin page
API address (Base URL) The API address you give AI tools
API Key The key you give AI tools
  1. Open the “management center” address in a browser.
  2. Paste the “management center login key” into the management key field and connect.

Details: Log in to the CLIProxyAPI management center.

2. Add your AI account

Two ways, depending on what you have:

  • Log in with your account (OAuth): you have a subscription such as ChatGPT (Codex) or Claude. Go to the OAuth login section, choose the service, and log in and authorize in the browser as prompted. A new entry then appears under auth files.
  • Enter an API key: you have an API key from an AI service. Go to AI providers, add the service and paste the key.

Heads up

If, after authorizing, the browser lands on a localhost address that won’t load, don’t worry: follow the management center’s prompt and paste the full URL from the address bar back into it. See Add accounts to CLIProxyAPI.

3. Check the API works

Run this in the terminal (with your own API address and API key):

List available models
curl -s https://your-IP:8318/v1/models -H "Authorization: Bearer your-API-Key"

You should see

You get back text containing model names (such as gpt-… or claude-…) — the account is added and the API works.

4. Connect AI tools

Most AI tools support an “OpenAI-compatible API” and need just two things:

  • API address / Base URL: the “API address (Base URL)” from the login-info file, like https://your-IP:8318/v1;
  • API Key: the “API Key” from the login-info file.

Exact settings for Cherry Studio, Claude Code, Codex and more: Connect your AI API to tools.

Don't do this

The API key and the management center login key are both access cards: don’t post or screenshot them, and never put them in code you upload to GitHub. Don’t share the API with others either — quota runs out fast and it may break the AI services’ terms of use.

It updates itself

CLIProxyAPI checks for new versions every 30 minutes and only switches at an idle moment — about one second, without interrupting a response in progress. If an update fails it rolls back automatically. Nothing for you to do.

Stuck?

The management center won't open?

Check the address starts with https:// and uses port 8318, and that your network can reach the server (see step 5’s exit IP check first).

The API returns 401?

The API key is wrong, or you used the management center login key as the API key. They’re two different keys.

It connects, but no models are listed, or calls fail?

No account added yet, or the account’s authorization has expired. Check its status under auth files and log in again if needed.

Before moving on, check

This setup is for you and your family only. Follow local laws and each site's and AI tool's terms of use. Open source (MIT) — code and feedback on GitHub.