Model Added but Not Working? Troubleshooting API Protocol Compatibility and Routing

    Saving a model configuration does not guarantee that an AI coding tool can use it. This guide explains how model identifiers, API protocols, and routing interact, how to verify a protocol adapter, and how to isolate failures through layered diagnostics and incremental tests for text generation, streaming, and tool calling.

    1. Why an Added Model May Still Be Unavailable

    A “Saved successfully” message usually means only that the configuration has been stored. It does not prove that the model service is reachable or that the coding tool can interpret its responses.

    A complete model call requires all of the following:

    • The coding tool loads the correct active configuration.
    • The request reaches the intended endpoint.
    • The server recognizes the request’s API protocol.
    • The credentials are valid and grant access to the target model.
    • The model identifier is valid for the configured service endpoint.
    • The coding tool can correctly parse the response.
    • Streaming and tool calling, if used, are also supported by the integration.

    A failure at any stage can appear as an “unavailable model.” Rather than repeatedly changing the API key or model name, first verify the entire request path.

    The key distinction is simple: adding a model registers configuration; protocol adaptation enables communication compatibility. These are separate tasks.

    2. Distinguish the Model, API Protocol, and Coding Tool

    The Model Determines Which Capabilities You Request

    A model provides capabilities such as text generation, code understanding, and reasoning. Clients typically select it through a model identifier, but that identifier does not define the complete calling procedure.

    Two models that both generate code may use different endpoints, authentication mechanisms, and message structures. Entering a model name tells the system which model you want—not how to communicate with it.

    You must also verify separately that the model exists, is available to the current account, and supports the required features. A name appearing in a configuration interface is not proof that the model is usable.

    The API Protocol Determines How Data Is Exchanged

    An API protocol defines the interaction between client and server, including:

    • Endpoint addresses and paths
    • HTTP methods
    • Authentication placement and format
    • Conversation message structure
    • Generation parameter meanings and constraints
    • Streaming event formats
    • Tool-call and tool-result representations
    • Error responses and completion states

    For example, one API may place system instructions in a dedicated field, while another requires them within a specific message structure. One may return a list of content blocks, while another returns nested candidate results. Both can generate text, but their data structures are not necessarily interchangeable.

    A reachable API is therefore not automatically compatible with a coding tool.

    The Coding Tool Determines What Requests Are Sent

    AI coding tools generally construct requests using the protocols they support and parse responses according to those formats. They may depend on specific message roles, streaming events, tool-call results, and finish reasons.

    If the tool sends protocol A but the model service accepts only protocol B, changing the endpoint and model name is usually insufficient. The server may reject the request, or it may return a response the client cannot parse.

    Configuration managers primarily store, switch, and distribute configuration. They can bridge different APIs only if they explicitly provide protocol conversion and that functionality is enabled.

    3. What a Protocol Adapter Actually Does

    When the client and upstream model service use different protocols, an adapter can sit between them:

    1. AI coding tool
    2. ↓ Sends a request using the client protocol
    3. Local routing or protocol adaptation service
    4. ↓ Rebuilds the request using the upstream protocol
    5. Model service
    6. ↓ Returns a response in the upstream format
    7. Local routing or protocol adaptation service
    8. ↓ Converts the response into the client’s expected format
    9. AI coding tool

    An adapter does more than forward network traffic. It must understand the semantics of both protocols.

    Request Conversion

    The adapter must handle message roles, system instructions, content blocks, generation parameters, and tool definitions. Fields should be mapped according to the protocols’ definitions, not copied mechanically by name.

    If a parameter has no equivalent, the implementation should ignore it, reject it, or explicitly downgrade the behavior, with an observable indication of what happened. Silently dropping important settings can produce requests that succeed but behave unexpectedly.

    Response Conversion

    Generated text, finish reasons, usage information, and tool-call instructions must be reorganized into the structure the client expects.

    This conversion determines whether the coding tool can continue processing the result. Even if the upstream model generates content successfully, incomplete response mapping can leave the client showing an empty result, reporting a parsing error, or waiting indefinitely.

    Streaming and Tool-Calling Adaptation

    Streaming requires handling event boundaries, incremental content, termination signals, and interrupted connections. Tool calling requires preserving call identifiers, argument structures, execution results, and their association with subsequent messages.

    These requirements are more complex than ordinary text conversion. An adapter that handles basic questions and answers may not fully support automated coding workflows.

    Also remember: an adapter can translate existing capabilities; it cannot give an upstream model features that the model does not support.

    4. Build a Reliable Configuration Workflow

    Configuration tools differ in their interfaces and capabilities. Do not assume that every version includes local routing. Follow the documentation and settings for the version you are using, while keeping the following verification order.

    Step 1: Confirm Support for the Required Protocol Pair

    Check whether the configuration tool can accept the protocol used by the coding client and send requests to the target model’s native API.

    If it only manages credentials or switches configurations, deploy a separate adapter with the required conversion capabilities. “Supports adding providers” does not mean “supports arbitrary API interoperability.”

    Step 2: Configure the Upstream Connection

    Upstream configuration usually includes a service address, credentials, and a model identifier.

    Pay particular attention to what the address field expects. Some implementations require a base URL and append the API path automatically. Others require the full request URL. Using the wrong format can cause missing paths or duplicated path segments.

    Use the model identifier supported by the actual service—not a display name, a guessed abbreviation, or an outdated identifier.

    Step 3: Select the Correct Upstream Protocol

    A service endpoint may expose a native API or a compatibility API. Choose the adaptation mode based on the actual interface, not assumptions about the model family.

    The configured upstream protocol must match the request format accepted by the target endpoint. A valid API key cannot fix a request constructed for the wrong protocol.

    Step 4: Start and Verify the Local Router

    After saving the configuration, confirm that the routing process is running and listening on the expected address and port.

    Check:

    • Whether the service started successfully
    • Whether another process is using the port
    • Whether the listening address is appropriate for local access
    • Whether configuration changes require a reload
    • Whether the running process is using the latest configuration

    An “Enabled” label in the interface is not sufficient evidence. Verify service status and logs.

    Step 5: Make Sure the Coding Tool Actually Uses the Router

    A common oversight is starting the router while the coding tool continues using its old endpoint.

    Inspect the tool’s effective configuration, including environment variables, user-level settings, project-level settings, and the current session. These sources may override one another; consult the tool’s documentation for the actual precedence rules.

    Restart the relevant processes if required, then check whether new requests appear in the router logs. Protocol conversion can help only when requests actually reach the adapter.

    5. Troubleshoot the Request Path, Not Just the Status Code

    HTTP status codes help narrow the search, but they do not map to causes on a strict one-to-one basis. Interpret them alongside response details, request paths, and the source of the log entry.

    Symptom Check first Important caveat
    Connection failure or connection refused Router process, listening address, port, firewall First establish whether the request can reach the local service.
    404 Base URL, API path, path concatenation, model routing Either the endpoint or the requested resource may be missing.
    405 Request method and target path This does not directly prove that local routing is disabled.
    401 Credential validity, authentication format, credential forwarding The error may originate from the local adapter or the upstream service.
    403 Account permissions, model access, access policies Some services also use this status for credential issues or other restrictions.
    400 Request structure, field types, parameter constraints Focus on the upstream request produced by protocol conversion.
    429 Usage quotas, rate limits, concurrency limits Uncontrolled retries can make the problem worse.
    Successful response with no content Response mapping, content types, termination events Network success does not guarantee a usable result.
    Workflow stops after a tool call Call identifiers, argument conversion, tool-result submission Verify the complete round trip, not just the first response.

    Logs can also help locate the failing stage:

    • No request reaches the local router: Check client configuration and network connectivity first.
    • The router receives the request but sends nothing upstream: Check protocol parsing, model mapping, and routing rules.
    • The upstream service explicitly rejects the request: Check authentication, permissions, paths, and request format.
    • The upstream service succeeds but the client fails: Check response conversion, streaming events, and tool-call structures.

    6. Validate Compatibility with Minimal Tests

    A complex coding task introduces multiple variables at once: conversation history, long context, tool execution, and file operations. This makes the original failure harder to isolate.

    Test incrementally in the following order.

    1. Simple Non-Streaming Text Request

    Send a short question without enabling tool calling. This verifies authentication, endpoint paths, the model identifier, and basic response conversion.

    2. Simple Streaming Request

    Check whether text appears incrementally, the connection terminates correctly, and the final content segment is preserved.

    If non-streaming requests work but streaming fails, focus on event conversion and buffering in intermediate layers.

    3. Multi-Turn Conversation

    Verify that conversation history is passed correctly, message roles appear in an order accepted by the upstream API, and no context is lost or request structure errors occur.

    4. A Single Tool Call

    Choose an operation with limited impact and a clear result. Verify that the tool definition, arguments, call identifier, and returned result remain consistent throughout the exchange.

    5. A Real Coding Task

    Only then test multi-file changes, consecutive tool calls, and longer context.

    Passing a basic test proves that the tested feature works. It does not replace validation of more complex workflows.

    7. Consider Security and Maintainability

    A local router may handle source code, conversation content, credentials, and tool execution results. Treat it as a sensitive component.

    By default, bind it only to a loopback address. If other devices need access, configure access controls. Never place credentials in public repositories, screenshots, or unredacted logs.

    Diagnostic logs should retain useful metadata where possible, including timestamps, request identifiers, target models, latency, status codes, and conversion stages. Redact credentials and sensitive content.

    For timeouts and rate limits, use bounded retries with backoff. For authentication failures or malformed requests, fix the configuration rather than retrying continuously.

    Automated coding workflows also need protection against duplicate tool operations caused by retries. A network interruption does not prove that the previous operation never happened.

    8. Verify the Request Path Before Tuning Model Parameters

    An added but unusable model is usually not just a model-name problem. The outcome depends on configuration loading, request routing, API protocols, authentication and permissions, and response parsing.

    The most effective troubleshooting sequence is:

    1. Identify the client protocol used by the coding tool.
    2. Identify the actual protocol exposed by the upstream model API.
    3. Determine whether protocol adaptation is required.
    4. Verify that the adaptation service is running.
    5. Confirm that client requests pass through it.
    6. Use minimal tests to validate text generation, streaming, and tool calling.
    7. Use logs from each layer to isolate remaining failures.

    Treat “configuration saved,” “upstream service reachable,” and “coding tool fully functional” as three separate validation stages. This avoids blind parameter changes and creates a model integration that is stable, diagnosable, and maintainable.