MoleAPIMoleAPI
DocumentationCLI Usage

How to Use Mainstream CLI Tools

How to use MoleAPI in mainstream command-line tools or plugins such as Claude Code, Cursor, and Gemini.

Mainstream CLI Integration Guide

When using local tools such as Cursor and Claude Code, you can directly replace the official API endpoint with MoleAPI's high-speed Gateway service. Configure it once to access all models.

Since many CLI tools also provide convenient VS Code plugins, this guide also covers how to use the VS Code plugins for unified reference.

1. Claude Code

When running Claude Code, you only need to specify the BaseURL and Token through environment variables:

export ANTHROPIC_BASE_URL="https://api.moleapi.com"
export ANTHROPIC_API_KEY="sk-your-moleapi-key"
claude

Or, even more simply, in a git bash or Linux environment, you can use the following one-liner to configure the environment variables:

export ANTHROPIC_BASE_URL="https://api.moleapi.com" && \
export ANTHROPIC_API_KEY="your-moleapi-api-key" && \
export ANTHROPIC_MODEL="claude-sonnet-4-5-20250929" && \
export ANTHROPIC_SMALL_FAST_MODEL="claude-haiku-4-5-20251001"

Command description:

  • ANTHROPIC_BASE_URL: Specifies MoleAPI's proxy service as the API request endpoint.
  • ANTHROPIC_API_KEY: Enter the API Key you obtained from MoleAPI.
  • ANTHROPIC_MODEL: Specifies the default large model (such as claude-sonnet-4-5-20250929).
  • ANTHROPIC_SMALL_FAST_MODEL: Specifies the small fast model (such as claude-haiku-4-5-20251001).

After this is configured, the CLI tool will use the MoleAPI high-speed channel by default and prioritize the models you specified, without requiring you to manually enter the relevant parameters each time you start it.

2. Cursor

In Cursor settings:

  • Go to Settings > Models
  • Enter your MoleAPI Token in OpenAI API Key
  • Change Base URL to https://api.moleapi.com/v1

A Cursor Pro subscription is required to customize the API interface. To use this feature, make sure you have upgraded to the Pro version.

3. GitHub Copilot / VSCode Plugins

Many LLM plugins (such as Continue.dev or Cline) allow you to customize the API endpoint:

  1. API Provider: Select OpenAI Compatible
  2. Base URL: https://api.moleapi.com/v1
  3. API Key: sk-your-moleapi-key
  4. Model Name: Enter a model as needed, such as gpt-4o or claude-3-5-sonnet-20241022.

How is this guide?

Last updated on

Back HomeGateway