Language
Inference Space Docs

Quickstart

Choose your development tool or SDK and integrate in minutes.

Quick integration with CC Switch

First pick a region and a route

The region owns your account, balance, and console — the two regions share nothing. The route is only a network path into that region, and you can switch it at any time without affecting your account or billing.

RegionConsoleRouteAPI baseWhen to use it
Globalhttps://ai.inf.spaceInternationalhttps://ai.inf.spaceEverything on a Global-region account
Chinahttps://cn.inf.spaceChina-accelerated (default)https://cn.inf.spaceCallers in mainland China that also download generated images / video there
Chinahttps://cn.inf.spaceInternationalhttps://global.inf.spaceChina-region accounts whose servers sit outside mainland China

When in doubt, take your region's default. Examples below use the Global region https://ai.inf.space; to use another route, change the base URL and nothing else. The Regions and network routes page covers the full endpoint reference.

Prepare an API key

Open your region's console (https://ai.inf.space for Global, https://cn.inf.space for China) and create a key on the API key management page. Keys start with gk_ and are shown in full only once, so save the key immediately. Do not screenshot, share, or commit it to a repository. If you suspect a leak, revoke it in the console and generate a new key immediately.

A key is valid only in the region that issued it. A China-region key returns 401 against https://ai.inf.space, and vice versa.

Use Codex Desktop

Codex Desktop supports macOS and Windows only. On Linux, use Codex CLI in the next section.

  1. Follow the official Codex Desktop installation guide, or download the appropriate installer directly:
  2. Open Codex Desktop, replace gk_YOUR_KEY with the key you just created, and run the setup command below:
curl -fsSL https://docs.inf.space/install/codex.sh | bash -s -- --key gk_YOUR_KEY
iwr https://docs.inf.space/install/codex.ps1 -OutFile setup-codex.ps1
.\setup-codex.ps1 -Key gk_YOUR_KEY

The installers write the China-accelerated route https://cn.inf.space by default. To change it, pass --route global (Global region) or --route cn-global (China region, international route) to the shell script, or -Route global / -Route cn-global to the PowerShell script. Re-running updates the config in place instead of duplicating it.

When finished, restart Codex Desktop, then open or create a workspace to start chatting and coding.

Use Codex CLI

If Codex CLI is not installed, first install Node.js from the official download page and verify that these commands are available:

node --version
npm --version

Then run:

npm install -g @openai/codex

Then replace gk_YOUR_KEY with the key you just created:

curl -fsSL https://docs.inf.space/install/codex.sh | bash -s -- --key gk_YOUR_KEY
iwr https://docs.inf.space/install/codex.ps1 -OutFile setup-codex.ps1
.\setup-codex.ps1 -Key gk_YOUR_KEY

The installers write the China-accelerated route https://cn.inf.space by default. To change it, pass --route global (Global region) or --route cn-global (China region, international route) to the shell script, or -Route global / -Route cn-global to the PowerShell script. Re-running updates the config in place instead of duplicating it.

Reopen the terminal and run this in your project directory:

codex

Use Claude Code

If Claude Code is not installed, first install Node.js from the official download page and verify that these commands are available:

node --version
npm --version

Then run:

npm install -g @anthropic-ai/claude-code

Then replace gk_YOUR_KEY with the key you just created:

curl -fsSL https://docs.inf.space/install/claude.sh | bash -s -- --key gk_YOUR_KEY
iwr https://docs.inf.space/install/claude.ps1 -OutFile setup-claude.ps1
.\setup-claude.ps1 -Key gk_YOUR_KEY

The installers write the China-accelerated route https://cn.inf.space by default. To change it, pass --route global (Global region) or --route cn-global (China region, international route) to the shell script, or -Route global / -Route cn-global to the PowerShell script. Re-running updates the config in place instead of duplicating it.

Reopen the terminal and run this in your project directory:

claude

Quick integration with CC Switch

  1. Install and open CC Switch from the CC Switch website or the latest release.
  2. Select Codex or Claude Code, click + to add a connection, then select Custom.
  3. Enter the Endpoint, API Key, and Model:
  • Endpoint: https://ai.inf.space/v1 (Global region; China region uses https://cn.inf.space/v1 or https://global.inf.space/v1)
  • API Key: your gk_ key
  • Model: gpt-5.6-sol
  • Endpoint: https://ai.inf.space (Global region; China region uses https://cn.inf.space or https://global.inf.space)
  • API Key: your gk_ key
  • Model: claude-sonnet-4-6
  1. Save and enable the connection, then verify it with the selected tool:

Codex: restart the terminal and run:

codex

Claude Code: run directly:

claude

API/SDK calls

Store the key in an environment variable on the server:

export INFERENCE_SPACE_API_KEY="gk_YOUR_KEY"
import OpenAI from "openai";

// Global region (default below)
// China region, accelerated route: https://cn.inf.space/v1
// China region, international route: https://global.inf.space/v1
const client = new OpenAI({
  baseURL: "https://ai.inf.space/v1",
  apiKey: process.env.INFERENCE_SPACE_API_KEY,
});

const response = await client.responses.create({
  model: "gpt-5.6-sol",
  input: "Introduce yourself in one sentence.",
});

console.log(response.output_text);
import Anthropic from "@anthropic-ai/sdk";

// Global region (default below)
// China region, accelerated route: https://cn.inf.space
// China region, international route: https://global.inf.space
const client = new Anthropic({
  baseURL: "https://ai.inf.space",
  authToken: process.env.INFERENCE_SPACE_API_KEY,
});

const message = await client.messages.create({
  model: "claude-sonnet-4-6",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Introduce yourself in one sentence." }],
});

console.log(message.content);

In production, store API keys only on the server. Do not put them in browser code or commit them to a repository.

On this page