Documentation navigation
On this page

Integrations

Coding agent configuration

Choose the agent you want to use, then enter the KHaiXAPI Base URL, API Key, and model as described in its section. After configuration, check the connection with a text request, streaming output, and one read-only tool call. Use the Image API separately for image generation.

Choose a protocol first

AgentRecommended protocolBase URL
Codex, OpenCode, Kilo, OpenClaw, PiOpenAI Responseshttps://api.khaix.net/v1
Hermes AgentChoose either Responses or Chat Completionshttps://api.khaix.net/v1
Cline, AiderOpenAI Chat Completionshttps://api.khaix.net/v1

The table shows Base URLs. Clients append /responses or /chat/completions themselves. When a field is named Base URL, enter the address through /v1.

Codex

Codex CLI, IDE extensions, and the app all read the current user's .codex configuration. The Windows path is %USERPROFILE%\.codex\; macOS, Linux, WSL, and SSH environments use ~/.codex/.

Add the following fields to config.toml:

~/.codex/config.toml
model = "gpt-5.6-sol"
model_provider = "openai"
openai_base_url = "https://api.khaix.net/v1"

Then save the key with the Codex login command:

Terminal
export KHAIX_API_KEY="sk-replace-with-your-key"
printenv KHAIX_API_KEY | codex login --with-api-key
codex login status

Restart Codex, then use /status to check the current model. Configure the approval policy, sandbox, Web Search, and command network permissions separately after the API is connected.

OpenCode

Edit ~/.config/opencode/opencode.json and connect through the @ai-sdk/openai Responses provider. If you already have a configuration, merge the provider below into it while preserving existing fields.

opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "model": "api/gpt-5.6-sol",
  "provider": {
    "api": {
      "npm": "@ai-sdk/openai",
      "name": "KHaiXAPI",
      "options": {
        "baseURL": "https://api.khaix.net/v1"
      },
      "models": {
        "gpt-5.6-sol": {
          "name": "GPT-5.6 Sol",
          "reasoning": true,
          "options": {
            "store": false,
            "reasoningEffort": "high",
            "reasoningSummary": "auto"
          }
        }
      }
    }
  }
}
Terminal
opencode auth login
opencode auth list

Select the configured api provider during authentication. In OpenCode, use /models to check the model. To remove old credentials, run opencode auth logout and select the provider when prompted.

Hermes Agent

Hermes Agent supports both Responses and Chat Completions modes. Start with Responses. If tool calls encounter protocol compatibility issues, switch to Chat Completions and test it separately.

Responses mode

~/.hermes/config.yaml
custom_providers:
  - name: khaix-responses
    base_url: https://api.khaix.net/v1
    key_env: KHAIX_API_KEY
    api_mode: codex_responses

model:
  provider: custom:khaix-responses
  default: gpt-5.6-sol

Chat Completions mode

~/.hermes/config.yaml
custom_providers:
  - name: khaix-chat
    base_url: https://api.khaix.net/v1
    key_env: KHAIX_API_KEY
    api_mode: chat_completions

model:
  provider: custom:khaix-chat
  default: gpt-5.6-sol

Write KHAIX_API_KEY=sk-replace-with-your-key to ~/.hermes/.env. Responses requests /v1/responses, while Chat mode requests /v1/chat/completions. If the model does not appear automatically, keep the manually configured model ID and test a conversation directly.

Cline

Cline connects through the OpenAI-compatible Chat Completions endpoint:

  1. Open Cline settings and select OpenAI Compatible as the API Provider.
  2. Set the Base URL to https://api.khaix.net/v1.
  3. Enter the API Key and set Model ID to gpt-5.6-sol.
  4. Keep advanced model parameters at their defaults, then run Verify.
  5. After the connection succeeds, test a text task and one read-only tool call.

Enter the Base URL through /v1; Cline appends /chat/completions automatically.

Kilo Code

The following configuration applies to the current Kilo Code VS Code version and CLI. The JetBrains version has different provider capabilities and interface, so the fields in this section do not apply.

  1. Open Settings → Providers and select Custom provider.
  2. Set Provider ID to khaix and Display name to KHaiXAPI.
  3. Select OpenAI Responses for Provider API.
  4. Set the Base URL to https://api.khaix.net/v1.
  5. Enter the API Key and set Model to gpt-5.6-sol.
  6. Save and send a short text task. If the model does not appear automatically, add the model ID manually.

OpenClaw

Using the OpenClaw custom provider format, edit ~/.openclaw/openclaw.json. The configuration below enables text input only and reads the key from an environment variable.

openclaw.json
{
  "models": {
    "providers": {
      "api": {
        "baseUrl": "https://api.khaix.net/v1",
        "apiKey": "${KHAIX_API_KEY}",
        "auth": "api-key",
        "api": "openai-responses",
        "authHeader": true,
        "models": [
          {
            "id": "gpt-5.6-sol",
            "name": "GPT-5.6 Sol",
            "reasoning": true,
            "input": ["text"]
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "api/gpt-5.6-sol"
      }
    }
  }
}

Set KHAIX_API_KEY before starting, or use an OpenClaw SecretRef. After saving, restart the gateway or main process, then test text output and tool calls.

Pi and Aider

Pi Agent

Edit ~/.pi/agent/models.json. The configuration below uses Responses; for Chat Completions, change api to openai-completions.

models.json
{
  "providers": {
    "khaix": {
      "baseUrl": "https://api.khaix.net/v1",
      "api": "openai-responses",
      "apiKey": "$KHAIX_API_KEY",
      "models": [
        {
          "id": "gpt-5.6-sol",
          "reasoning": true
        }
      ]
    }
  }
}

Aider

Terminal
export OPENAI_API_BASE="https://api.khaix.net/v1"
export OPENAI_API_KEY="sk-replace-with-your-key"
aider --model openai/gpt-5.6-sol

Verification and permissions

  1. Text: Ask the agent to reply with a fixed phrase, then check the model, status code, and console record.
  2. Streaming: Send a longer text-only task and check for midstream disconnects or duplicated output.
  3. Tools: Allow reading only one non-sensitive file in the current directory, then check tool arguments, result submission, and the next model request.
  4. Errors: Enter a nonexistent model and confirm that the client displays an error instead of switching to another provider.

For authentication, URL, status-code, or interrupted-stream issues, follow the “cURL first, client second” sequence in Troubleshooting and security.