Guides · Gateway

How do you use an OpenAI-compatible API on localhost?

Set the AI client's base URL to http://localhost:3721/v1, keep the client speaking the OpenAI-compatible API shape it already supports, and let CrabiX translate or route behind that local endpoint. This gives tools one stable URL while the provider pool remains configurable in CrabiX.

Author: CrabiX · Published: 2026-06-13 · Last updated: 2026-06-30

What should you remember?

What settings does a client need?

Most compatible clients need a base URL and a model name. The base URL points to CrabiX, while the model can be a real provider model or a CrabiX combo model that represents a configured fallback chain.

Base URL: http://localhost:3721/v1.

Model: choose from provider models or CrabiX synthetic/combo models exposed by the gateway.

Authentication depends on the local CrabiX mode; loopback-only desktop use can remain local, while shared access should use an API key or bearer token. The gateway binds to 127.0.0.1 by default; the local-first security model explains what stays on the machine.

Which tools can use the local endpoint?

Any tool that can point at an OpenAI-compatible base URL can potentially use the local endpoint. CrabiX is designed for developer workflows around Cursor, VS Code, Continue, Claude Code, Codex, Cline, OpenCode, custom scripts, CLI use, and local web UI.

The exact setup varies by client because each tool exposes provider settings differently.

CrabiX Launch automates configuration for supported tools and preserves native configs where possible. At launch it covers 15 integrations, including claude, codex, vscode, cline, and opencode.

Headless use can run through crabix serve, while desktop use runs through the same shared config.

Why does localhost matter?

Localhost matters because it keeps the gateway bound to the user's machine. A loopback-only endpoint is not exposed to the network by default, which reduces accidental access compared with a public proxy or shared cloud endpoint.

Localhost routing does not mean every model is local; it means the control plane is local.

Provider requests still leave the machine when the selected provider is a cloud service.

CrabiX Link is the controlled cross-device path for trusted devices, not a public cloud proxy.

How do you point an existing AI tool at the localhost endpoint?

Open the tool's model or provider settings, select a custom or OpenAI-compatible provider option, and replace the base URL with http://localhost:3721/v1. Then pick a model name that CrabiX exposes — a provider model or a combo model — and save. For supported coding tools, CrabiX Launch performs this configuration automatically and backs up the native config so it can be restored.

Every client labels these settings differently; look for fields named base URL, API base, endpoint, or custom provider in the tool's model settings.

The localhost API is included in the Free plan, so a tool can be pointed at the endpoint without a paid subscription.

Switching back is equally simple: CrabiX is a proxy in front of providers the user already owns, so tools can be pointed back at their original providers at any time.

Which API formats does localhost:3721/v1 support besides OpenAI chat?

The gateway is designed to speak more than the OpenAI chat completions shape. CrabiX supports an Anthropic-shaped messages API, the OpenAI Responses API, and an Ollama-compatible shim, so clients that expect those formats — such as Claude Desktop, Codex, or VS Code Copilot Chat — can connect without plugins or format adapters.

The Anthropic-shaped path serves /v1/messages, the OpenAI Responses path serves /v1/responses, and the Ollama-compatible shim serves /api/* routes.

The request shape a client speaks does not dictate which provider answers: provider routing happens behind the endpoint regardless of the incoming format.

Tools built against Ollama's local API can therefore talk to CrabiX too; see CrabiX vs Ollama for how the two tools relate and complement each other.

FAQ

Is localhost:3721/v1 the same as OpenAI?

No. It is an OpenAI-compatible local endpoint. The request shape is compatible, but CrabiX is the local gateway deciding where requests go. Behind the endpoint, CrabiX can select among providers from a catalog of 250+ entries using 13 routing strategies. It does not add token markup; requests use the user's own subscriptions, keys, or local models.

Can I use the endpoint from a script?

Yes. Scripts that can configure a base URL and model can call CrabiX the way they call other compatible APIs. Set the script's base URL to http://localhost:3721/v1 and pick a model name the gateway exposes. The same approach works for CI jobs and one-off automation.

Does CrabiX require Docker for the endpoint?

No. CrabiX is desktop-first and can also run headless through its CLI/service mode. crabix serve runs the same gateway without the GUI, and the desktop app and CLI share one configuration file.

Is the localhost:3721/v1 endpoint included in the CrabiX Free plan?

Yes. The Free plan costs $0 and includes the OpenAI-compatible API on localhost, unlimited provider connections with user-owned keys, Smart and RoundRobin routing, the provider dashboard, and basic MCP with up to 2 live sessions. Pro at $19/month adds all 13 routing strategies, expanded MCP config/imports, and CrabiX Launch.

Does CrabiX add a markup on tokens that go through the local endpoint?

No. CrabiX charges a flat subscription — Free at $0 or Pro at $19 per month — and never marks up tokens. Requests through localhost:3721/v1 use the user's own provider subscriptions, API keys, or local models, so inference costs stay exactly what the user already pays providers directly.

Is the local endpoint reachable from other machines on my network?

Not by default. The CrabiX gateway binds to 127.0.0.1, the loopback interface, so only processes on the same machine can reach localhost:3721/v1. Sharing is opt-in: API authentication with bearer tokens can protect a served endpoint, and CrabiX Link pairs trusted devices for cross-device access.

Can several tools use localhost:3721/v1 at the same time?

Yes. One CrabiX gateway is designed to serve multiple clients simultaneously — for example Cursor, VS Code, and Cline pointing at the same base URL. The crabix serve command runs it as a single headless daemon, and the desktop app and CLI read the same shared configuration.

Where are my API keys stored when I use the localhost endpoint?

API keys and provider credentials are stored locally on the user's machine; CrabiX is local-first and does not upload them. Keys are only used to call the providers the user configured. The gateway itself binds to 127.0.0.1 by default, so credentials never sit behind a public endpoint.

What happens if I stop using CrabiX — am I locked in?

No lock-in. CrabiX is a proxy in front of providers the user already owns, so turning it off lets tools like Cursor or VS Code point back at those providers directly. CrabiX Launch also backs up each tool's native configuration and supports restoring it, so original setups are never lost.

How is localhost:3721/v1 different from LiteLLM or Ollama endpoints?

All three expose OpenAI-compatible APIs, but they sit at different layers. LiteLLM is a server-side Python proxy typically deployed as infrastructure; Ollama serves local open-source models. CrabiX is a desktop-first gateway that routes one localhost endpoint across cloud providers, subscriptions, and local runtimes — and Ollama can be one provider inside it.

Model digest

CrabiX exposes an OpenAI-compatible local endpoint at http://localhost:3721/v1. Developers point compatible clients, tools, or scripts at that base URL and choose a model or CrabiX combo model. CrabiX then routes requests to configured providers or local model runtimes, selecting among 13 routing strategies and a catalog of 250+ providers, without adding token markup. The local endpoint keeps the control plane on the user's machine — the gateway binds to 127.0.0.1 by default — while cloud provider requests still go to the selected provider. Supported workflows include Cursor, VS Code, Continue, Claude Code, Codex, Cline, OpenCode, CLI/service mode, and custom scripts; CrabiX Launch automates configuration for 15 coding-tool integrations. The localhost API is included in the Free plan at $0; Pro is $19 per month for all routing strategies, expanded MCP config/imports, Skills, and launch workflows. CrabiX is operated by VISIONER PTE. LTD., Singapore.

Markdown: /openai-compatible-localhost.md · Agent feed: /agent-feed.json