How to Connect a Custom LLM to Your Coding Tool: A Complete Configuration Guide

    This guide walks through connecting a self-hosted or third-party hosted large language model to an AI coding tool. It explains why the setup commonly stalls, the three pieces of information to prepare in advance, the configuration steps in order, a troubleshooting table for frequent failures, and hardening practices for team rollout. You will learn how to pick the right provider type, verify connectivity before saving, and make sure the new model actually takes effect in your session.

    1. Why connecting a custom model gets stuck

    Connecting a self-hosted or third-party hosted large language model to a coding tool is essentially protocol integration between the client and the model service. The tool only handles the interaction layer and context assembly; the actual inference capability comes from the endpoint and key you enter. Understanding this explains the three issues beginners run into most often: they cannot find where to add a model, they pick the wrong provider type, or the configuration saves successfully but chat still uses the default model.

    These three problems have different root causes:

    • The entry point is missing: most tools place model configuration under Settings > Models/Providers rather than in the installation wizard, so you have to go back in after installation.
    • The wrong provider is selected: providers differ in request body structure, authentication headers, and streaming protocols, so a wrong choice means “the parameters are correct but the call still fails.”
    • The old model is still used after saving: this is a scope problem. The global default model and the model selected for the current session or workspace are two separate configurations, and the change does not take effect until they are in sync.

    2. Three things to prepare before you start

    Gathering the information up front significantly reduces trial and error.

    1. Base URL: distinguish the domain root from the full address that includes a version path. They are concatenated differently, so follow the provider’s documentation instead of guessing at suffixes such as /v1.
    2. API key: confirm the key has invocation permission, has not expired, and is not rate limited. In enterprise environments, a common issue is that the key is not allowed through on the gateway side.
    3. Model ID: the model identifier must match the name registered on the server character for character. Uppercase and lowercase letters, dots, and hyphens are all part of the name.

    An illustrative configuration structure (it only expresses what the fields mean, not a specific API):

    1. {
    2. "provider": "custom",
    3. "baseUrl": "https://your-endpoint.example",
    4. "apiKey": "<your-key>",
    5. "models": [
    6. { "id": "<model-name>", "contextWindow": 128000, "stream": true }
    7. ]
    8. }

    3. Configure it in order

    Step 1: Locate the model entry point

    Open the tool’s settings panel and look for a name like Model Management, Providers, or Custom Model. If you are on a team or enterprise edition, the entry point may be under workspace settings rather than personal settings, where you only have permission to use models, not to add them.

    Step 2: Select the right provider type

    • If the target is a service compatible with a unified calling protocol, the safest choice is “Custom / compatible mode,” because it depends only on three things: the address, the key, and the model name.
    • If the target is a service with a proprietary protocol, you must select the matching type, or the field mapping will be misaligned.
    • When unsure, prefer compatible mode: it gives up a few proprietary features in exchange for the widest range of services you can actually reach.

    Step 3: Fill in the parameters and verify connectivity

    Before saving, send a minimal request to confirm the path works:

    1. curl -sS "$BASE/chat/completions" \
    2. -H "Authorization: Bearer $KEY" \
    3. -H "Content-Type: application/json" \
    4. -d '{"model":"<model-name>","messages":[{"role":"user","content":"ping"}]}'

    Watch for three kinds of responses: a normal reply means the address and authentication are correct; an authentication error points to the key or its permissions; a model-not-found error points to a misspelled model identifier.

    Step 4: Make the configuration actually take effect

    After saving, go back to the chat interface and explicitly select the new model in the model switcher. Changing the global default usually only affects new sessions; a session that is already open still holds the model reference from when it was created. This is the most common reason for “it saved successfully but nothing changed.” The reliable approach is to start a new session and verify there.

    4. Common problems and how to trace them

    Symptom Likely cause Fix
    Chat still uses the original model after saving Session scope not synchronized Start a new session and switch manually
    Authentication failure Wrong or expired key, or the gateway is not allowing it through Reissue the key and check its permission scope
    Model not found Model identifier mismatch Compare the server-side name character by character
    Request timeout Address path or network policy issue Check the full address and outbound rules
    Output is not streamed and feels laggy Streaming disabled or buffering in an intermediate layer Enable streaming and check proxy buffering settings

    5. Hardening recommendations for team adoption

    Getting it working for yourself is only the starting point. When rolling out to a team, add four things: first, have a configuration center or key management service issue keys centrally instead of hardcoding them into repositories; second, set quotas and rate limits per model so a single project cannot crowd out resources; third, connect logging services and monitoring alerts to continuously track call failure rates and latency; fourth, on cloud platforms such as Baidu AI Cloud, you can use object storage to hold corpora, message queues to decouple asynchronous tasks, and container platforms to host self-built inference services, upgrading model integration from “client configuration” to an operable engineering capability.

    At this point the full loop is closed: locating the entry point, choosing the type, validating the parameters, and switching scope. Follow the steps in order and almost any connection failure can be traced to a specific stage within five minutes.