New APINew API
User GuideInstallationAPI ReferenceAI ApplicationsSkillsHelp & SupportBusiness Cooperation
User Guide

API Keys

Create, copy, and manage API keys for calling models. Set quota and expiration limits, restrict models and IP addresses, and import keys into clients such as CC Switch in one click.

  • In the sidebar, go to “General” → “API Keys”.
  • Create and manage API keys.
  • Model calls deduct quota from your account (wallet balance or subscription quota) based on pricing.

Tip

  • An API key is a credential that a program or client uses to call models. It starts with sk- and is also called a “Token” in some messages.
  • The site determines the quota unit.
  • If “API Keys” is missing from the left sidebar, go to “Profile”, find “Personal Left Sidebar Settings”, enable “Console Section” and “Token Management”, and save your changes.

API Keys Overview

  • API Keys – List

API Keys list page

Use the list to filter by API key, key name, or status, and to view and manage your keys.

Tip

If a model call fails, see Frequently Asked Questions.

Field descriptions

FieldDefinitionRequirements and limitsNotes
NameThe key name, used to identify its purpose or environment.Required when creating or editing a key. Up to 50 English characters or approximately 16 Chinese characters.—
StatusThe key’s current status: Enabled, Disabled, Expired, or Exhausted.You cannot edit the status directly. Use the power icon in the row to switch between “Enabled” and “Disabled”. The system automatically marks keys as “Expired” or “Exhausted”. You cannot enable these keys directly.See API Key Status for details. Rows for keys that are not enabled appear grayed out.
API KeyThe credential used to call models. It starts with sk-.The system generates the key when you create it. The key cannot be changed. Viewing and copying full keys is rate-limited, including when copying connection info, importing into CC Switch or chat apps, and copying in bulk. Too many actions in a short period will fail. Wait before trying again. You may need to wait more than 10 minutes.The list shows only the first and last few characters. Click the key text to view the full key or click the icon on the right to copy it.
Quota (…)The key’s available and used quota. The site’s quota unit appears in parentheses.Configure this with “Quota” and “Unlimited Quota” in the create or edit dialog. This setting limits usage for the key itself. Model calls still deduct quota from your account.Keys with unlimited quota show “Unlimited” and the amount used. Keys with a quota limit show the remaining quota, used quota, and a progress bar. Click to view “Remaining”, “Used”, and “Current Total Quota”.
GroupThe group used for model calls, which determines available routes and billing ratios.Select a group under “Group” in the create or edit dialog. You can select only groups your account has access to.Shows the group name and ratio, such as “1x”. If no group is specified, “User Group” and “Inherited” indicate that the key uses the account’s group. “Cross-Group” indicates that the key uses the auto group.
ModelsThe models the key can call.Select models under “Model Restrictions” in “Advanced Settings”. You can select only models available to your account.Shows the number of selected models. Hover to see the list. “Unlimited” means the key can call all available models.
IP RestrictionsThe range of IP addresses allowed to use the key.Configure the “IP Allowlist” in “Advanced Settings”. Only IP addresses on the allowlist can use the key.Shows the number of IP addresses or subnets entered. Hover to see the list. “Unlimited” means there are no IP restrictions.
TimeThe key’s creation time and last-used time.The system records these times automatically. They cannot be changed.Shows “Created At” and “Last Used”. For a newly created key, both timestamps are the same.
ExpirationThe time at which the key expires.Set this under “Expiration Time” in the create or edit dialog. The key cannot be used to call models after it expires.“Never” means the key does not expire. Past expiration times appear in red. This column is hidden in the screenshot. To show it again, select it under “View”.
ActionsThe controls for actions on an individual key.“Chat” appears only if an administrator has configured chat apps.Includes the in-row enable/disable icon, edit icon, and ⋯ menu. See Row Actions.

Create an API Key

  • API Keys – Create API Key

Create API Key page

Steps

  1. Click “Create API Key” in the upper-right corner of the page.
  2. Enter a key name that identifies the app or environment.
  3. Configure the quota, expiration time, model restrictions, IP restrictions, group, and other settings as needed.
  4. Click “Save Changes”.

Configuration options

The dialog has three sections: “Basic Information”, “Quota Settings”, and “Advanced Settings”. “Advanced Settings” is collapsed by default. Click its heading to expand it. The table lists the options in the order they appear in the dialog.

OptionSectionDefinitionRequirements and limitsDefault
NameBasic InformationThe key name, used to identify its purpose or environment.Required. Include the name of the app or environment that uses the key. The limit is 50 English characters or approximately 16 Chinese characters. If you exceed the limit, the dialog displays “Token name is too long”.Blank
GroupBasic InformationThe group used for model calls, which determines available routes and billing ratios.Optional. The dropdown lists only groups your account has access to, along with each group’s description and ratio. Select auto to let the system choose an available group automatically.No selection (“Select a Group”), so the key uses the account’s group. Some sites select auto by default.
Auto Group OrderBasic InformationThe groups the key tries when using the auto group, in the order it tries them.Appears when “Group” is set to auto. Keep the default order or click “Add Auto Group” and drag the groups to reorder them. A custom order must include at least one group with no duplicates. The dialog shows the maximum number of groups (5 by default).“Inherit Global Auto Order”
Cross-Group RetryBasic InformationControls whether a failed model call is retried with the next group in the list.Appears when “Group” is set to auto. Enable or disable it as needed. It applies only to the auto group. The “Request Policy” link at the end of the description is visible only to Root and opens the relevant system settings for the site.Enabled automatically when auto is selected
Expiration TimeBasic InformationThe time at which the key expires.Optional. Choose a date and time or click “Never”, “1 Month”, “1 Day”, or “1 Hour”. The three durations are measured from the current time. The system accepts past times, which makes the key unusable for model calls as soon as you save it.Blank (“Never Expires”)
QuantityBasic InformationThe number of keys to create at once.Appears only when creating keys. The minimum is 1. If you create multiple keys, the first key uses the name you entered. The other keys get a random seven-character suffix, and the same length limit applies to the resulting names. If creation fails partway through, the process stops and any keys already created are retained. Each account has a key limit (1,000 by default). Exceeding it displays “Maximum token count reached (…)”.1
Quota (…)Quota SettingsThe maximum quota this key can use. The site’s quota unit appears in parentheses, as in “Quota ($)”.Appears when “Unlimited Quota” is off. Enter a non-negative number. If the value exceeds the maximum, the dialog displays “Quota value is out of range. The maximum is …”. The key cannot call models once its quota is exhausted.10
Unlimited QuotaQuota SettingsControls whether the key has its own usage limit.Turn this setting on or off as needed. Turning it off shows the “Quota” field above it. Turning it on removes the key’s usage limit. Model calls still deduct quota from your account and fail if the account has insufficient quota.On
Model RestrictionsAdvanced SettingsThe models the key can call.Optional. You can select multiple models from those available to your account. Leave the field empty to allow calls to all available models.No selection (unrestricted)
IP Allowlist (CIDR supported)Advanced SettingsThe IP addresses or subnets allowed to use the key.Optional. Enter one IP address or CIDR subnet per line, such as 192.168.1.0/24. Comma-separated entries are unsupported. Leave the field blank to allow any IP address. The system ignores malformed lines. If every line is invalid, no address can use the key. IP addresses can be spoofed, so avoid relying on the allowlist as your only security measure.Blank (unrestricted)
Allow User Quota QueriesAdvanced SettingsControls whether the Get Token Usage endpoint also returns the account’s remaining and used quota when called with this key.Turn this setting on or off as needed. It does not affect model calls.On

Copy a Key and Call a Model

Steps

  1. In the key’s row, click the copy button next to the key in the “API Key” column.
  2. Paste the key into your client.
  3. Click “API Address” in the upper-right corner of the page.
  4. Use the descriptions to choose an API address, then click the copy button next to it.
  5. Paste the API address into your client.

Calling models

  1. In a client, the API address usually comes without /v1. Most OpenAI-compatible clients expect the API address followed by /v1 in the Base URL field. Check your client’s documentation.
  2. For a direct request, append the endpoint path to the API address. The example below uses /v1/chat/completions for the chat endpoint.
curl https://your-host/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-xxxxxxxx" \
  -d '{"model":"模型名称","messages":[{"role":"user","content":"你好"}]}'
  • Replace https://your-host with the API address you copied, sk-xxxxxxxx with your API key, and 模型名称 with an available model name.
    This command works in macOS and Linux terminals and in Git Bash on Windows.
  • To see which models the key can call, send a request to the API address with /v1/models appended. See List Models (Native OpenAI Format).
    For other endpoints and parameters, see the API documentation, including ChatCompletions Format.

Keep Your API Key Secure

  • Anyone who obtains your API key can use it to consume your account quota.
  • Do not share your key in group chats or include it in screenshots or public code repositories.
  • If you suspect a key has been exposed, delete it immediately and create a new one.

Import into CC Switch or a Chat App

  • API Keys – Import into CC Switch

Import into CC Switch page

CC Switch is a desktop tool for managing Claude Code, Codex, and Gemini CLI configurations. Install it on your computer before using this feature.

Import into CC Switch

  1. Open the ⋯ menu at the end of the key’s row and select “CC Switch” from the main menu to open the “Import into CC Switch” dialog.
  2. Under “App”, select Claude, Codex, or Gemini.
  3. Enter the configuration details as needed.
  4. Click “Open CC Switch”.
  5. Your browser prompts you to open CC Switch. After you confirm, CC Switch imports the API address, selected key, and model configuration.

Import into another chat app

  1. Click ⋯ at the end of the selected key’s row to open the menu.
  2. Under “Chat”, select the chat app you want to import the configuration into.

Tip

  • Web apps open in a new tab. Install desktop apps and browser extensions first so the browser can launch them or pass the key to them directly.
  • “Chat” in the sidebar automatically uses the most recently created enabled key.

Edit, Disable, or Delete a Key

  • API Keys – Update API Key

Update API Key page

Edit a key

  1. Click the edit icon in the key’s row.
  2. Change the settings in the “Update API Key” dialog as needed.
  3. Click “Save Changes”.

Disable or enable a key

  1. Click the power icon in the key’s row. The icon shows “Disable” for enabled keys and “Enable” for keys in all other states.
  2. The change takes effect immediately without a confirmation dialog.

Tip

You cannot directly enable keys marked “Expired” or “Exhausted”. See API Key Status for instructions.

Delete a key

  1. Click ⋯ at the end of the key’s row and select “Delete”.
  2. Check the key name and click “Delete”. To delete multiple keys at once, see Bulk Actions.

Warning

Deletion is permanent. Programs and clients using the key will immediately lose the ability to call models with it. To suspend a key temporarily, select “Disable”.

Configuration options

The “Update API Key” dialog has the same options as the creation dialog and opens with the key’s current settings. For option definitions, requirements, limits, and defaults, see Create API Key Configuration Options. The table below lists the options that behave differently when you update a key.

Option“Create API Key” dialog“Update API Key” dialog
QuantityShown with a default of 1. You can create multiple keys at once.Hidden. You can edit one key at a time.
GroupNo group is selected by default. Some sites select auto by default.Shows the key’s current group. If that group is no longer available, the dialog automatically selects an available group when it opens. The change takes effect when you save.
Expiration Time, Quota (…)The values you enter take effect when you save.After changing these settings for an “Expired” or “Exhausted” key, select “Enable” in the list to reactivate it.

Tip

  • To replace a key, create a new key and delete the old one. To enable or disable a key, use the power icon in its row.

Actions and Controls

Page Buttons and Filters

ActionLocationDescription
Create API KeyUpper-right corner of the pageOpens the “Create API Key” dialog. See Create an API Key.
API AddressUpper-right corner of the pageLists the API addresses provided by the site. Each entry has a name, an address, a description, and a copy button. The description may be blank. If the site has no custom API addresses configured, the list shows a single “Default API Address” or “Current Domain” entry.
Filter by Name...Toolbar above the listFinds keys by name and refreshes the list automatically as you type. The filter matches the full name by default. For a partial match, add % before and after the keyword, as in %notebook%. Use at most two % characters and enter at least two other characters.
Filter by API Key...Toolbar above the listFinds keys by their full value. You can omit the sk- prefix. Partial matching follows the same rules as the name filter.
StatusToolbar above the listFilters by one status at a time. The filter applies only to keys loaded on the current page. If you have many keys, increase “Rows per Page” first.
ViewToolbar above the listUse “Toggle Columns” to choose which columns to show. Your settings are saved in the current browser.
ResetToolbar above the listAppears when filters are active. Click it to clear all filters.
Rows per Page, paginationBottom of the list“Rows per Page” defaults to 20. Choose from 10, 20, 30, 40, 50, or 100.

Row Actions

ActionLocationDescription
View Full KeyKey text in the “API Key” columnShows the full key in the “Full API Key” dialog.
Copy API KeyCopy icon on the right side of the “API Key” columnCopies the full key in that row.
Enable / DisablePower icon in the “Actions” columnToggles the key’s enabled status immediately without a confirmation dialog. You cannot directly enable keys marked “Expired” or “Exhausted”. See API Key Status.
EditEdit icon in the “Actions” columnOpens the “Update API Key” dialog. See Edit, Disable, or Delete a Key.
Copy Key⋯ menu in the “Actions” columnCopies the full key in that row.
Copy Connection Info⋯ menu in the “Actions” columnCopies the full key and this site’s address so administrators can fill in the “Create Channel” dialog in New API in one click. Model calls do not require this action.
CC Switch⋯ menu in the “Actions” columnOpens the “Import into CC Switch” dialog. See Import into CC Switch or a Chat App.
Chat⋯ menu in the “Actions” columnExpands the list of configured chat apps. This option appears only if an administrator has configured chat apps. See Import into CC Switch or a Chat App.
Delete⋯ menu in the “Actions” columnPermanently deletes the key after confirmation.

Bulk Actions

ActionLocationDescription
Select KeyCheckbox at the start of each rowSelects an individual key. Selecting a key shows the bulk action bar at the bottom of the page.
Select All on Current PageCheckbox in the table headerSelects all keys on the current page.
Copy Selected KeysBulk action bar at the bottomCopies all selected keys, one per line, with a tab between each name and key.
Delete Selected API KeysBulk action bar at the bottomPermanently deletes all selected keys after confirmation.
Clear Selection× on the left side of the bulk action barClears all selections. You can also press Esc.

Status Reference

API Key Status

The following four statuses appear in the list’s “Status” column and in the “Status” filter.

StatusMeaningNotes
EnabledThe key can be used to call models.—
DisabledThe key was manually disabled.To re-enable it, select “Enable” in the list.
ExpiredThe key’s “Expiration Time” has passed.Trying to enable the key directly displays “The token has expired and cannot be enabled…”. Edit the key, set “Expiration Time” to a future time or “Never”, and save. Then select “Enable” in the list.
ExhaustedThe key has used up its own quota. The account balance is tracked separately.Trying to enable the key directly displays “The token’s available quota is exhausted and it cannot be enabled…”. Edit the key, increase “Quota” or turn on “Unlimited Quota”, and save. Then select “Enable” in the list.

Frequently Asked Questions

  • Wallet — Top up your balance, redeem Quota, and view your account balance and subscriptions.
  • Usage Logs — View details and charges for each request.
  • Model Marketplace and Leaderboard — View available models and their prices.
  • Chat — Open a chat app from “Chat” in the sidebar or configure a client manually.

How is this guide?

Last updated on