All guides / Coding assistants

Use XHuoAPI in fx (Vercel Labs)

fx is an open-source coding agent CLI from Vercel Labs: one native binary that can connect to any OpenAI Chat Completions–compatible endpoint. XHuoAPI provides that endpoint, so one connection in the settings file is enough. We had fx 0.0.13 create and run a file for real, and the config below is the one we tested.

Before you start

Verify first

Before touching the tool, confirm the key and model work with curl. This rules out half of the 'I configured it and nothing happens' cases.

curl https://api.xhuoapi.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-..." \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-v3.2","messages":[{"role":"user","content":"ping"}]}'

Steps

1

Install fx (macOS 15 or later, or Linux; macOS builds need 15+ since 0.0.14). The installer puts it in ~/.local/bin.

curl -fsSL https://fx.sh/setup.sh | bash
2

Edit ~/.fx/settings.json (create it if it doesn't exist) and add the connection below. End base_url at /v1; fx appends /chat/completions itself. Use model IDs exactly as written on the pricing page.

{
  "provider": "xhuoapi",
  "providers": {
    "xhuoapi": {
      "protocol": "openai-chat-completions",
      "base_url": "https://api.xhuoapi.ai/v1",
      "auth": { "type": "bearer", "env": "XHUOAPI_API_KEY" },
      "model_metadata": {
        "glm-5.3": { "supports_tool_use": true },
        "kimi-k3": { "supports_tool_use": true },
        "deepseek-v4-flash": { "supports_tool_use": true }
      }
    }
  },
  "models": { "xhuoapi": "glm-5.3" }
}
3

Put your API key in the environment variable named by auth.env, then run fx status --json and check that provider_endpoint and model are right.

export XHUOAPI_API_KEY=YOUR_XHUOAPI_KEY
fx status --json
4

Run fx in your project directory for interactive mode, or fx ask for a one-off task. Use the FX_MODEL environment variable to switch models for one run.

fx ask "Create hello.py that prints hello, then run it"
FX_MODEL=kimi-k3 fx ask "Explain what this repository does"

Notes

Test results (2026-10-14, fx 0.0.13, asking fx to create and run a file): glm-5.3 passed both runs (33–79 s), kimi-k3 passed both runs (27–31 s), and deepseek-v4-flash passed 5 times out of 6. qwen3.8-max failed all 4 runs with InconsistentFinishReason. Re-tested on 2026-10-18 with 0.0.14: glm-5.3 and kimi-k3 passed; deepseek-v4-flash kept failing with InvalidFinishReason (0.0.13 too), because some responses for this model currently send finish_reason as an empty string, which fx rejects. In fx, use glm-5.3 or kimi-k3 for now.
In fx's default auto permission mode, a model reviews risky actions first. It uses the connection's reviewer_model, or the selected model when none is set, and those requests are billed as normal tokens. To spend less, add a cheaper model to the connection, for example "reviewer_model": "deepseek-v4-flash".
model_metadata can also hold context_window (the model's context length) and max_output_tokens. fx works without context_window, but then it can't work out when to compact the session automatically; if you add it, use the length the model's vendor publishes.
If fx reports a missing credential, check that the variable named in auth.env is exported. For an HTTP error, read the endpoint's response; a misspelled model ID is the usual cause. base_url must use HTTPS.
The model ID must match the pricing page exactly (deepseek-v4-pro, not DeepSeek V4 Pro). Case and hyphens matter.

Commonly used models

These are common choices for this kind of tool; click a model to see its price in each tier. The full list is on the pricing page.

Which Chinese models work in Claude Code, Codex CLI and fx (tested) →

Steps follow the tool's current official documentation; the UI may change after updates. Tell us if something no longer matches.