Skip to content

AI inference

Coding tool setup

Every tool below wants the same three values in a different place. Two of them have a gotcha worth knowing before you spend an afternoon on it, and the troubleshooting table at the end maps every error this endpoint returns to what actually caused it.

What every tool needs #

  • Base URLhttps://inference.maxlayer.cloud/v1. Keep the /v1; the client appends the route beneath it.
  • API key — an organization key from Settings → API keys, starting mxl_. Not the token your browser session uses; that identifies a person rather than an organization, so there would be no balance to charge.
  • Model id — copied verbatim from the catalogue, slash included, e.g. anthropic/claude-sonnet-5.

Cursor #

Settings → Models. Enable Override OpenAI Base URL, set it to https://inference.maxlayer.cloud/v1, paste the mxl_ key as the OpenAI API key, then add the model id under the custom model list and verify.

Continue #

Configure an openai provider with apiBase. Continue keeps its configuration in ~/.continue/config.json — newer versions also accept config.yaml with the same fields.

~/.continue/config.json
{
  "models": [
    {
      "title": "Maxlayer · Llama 3.1 70B",
      "provider": "openai",
      "apiBase": "https://inference.maxlayer.cloud/v1",
      "apiKey": "mxl_…",
      "model": "anthropic/claude-sonnet-5"
    }
  ],
  "embeddingsProvider": {
    "provider": "openai",
    "apiBase": "https://inference.maxlayer.cloud/v1",
    "apiKey": "mxl_…",
    "model": "openai/text-embedding-3-small"
  }
}

The separate embeddingsProvider is what makes @codebase work. Point it at an embedding model from the catalogue — a chat model there returns a request error rather than an index.

Cline and Roo #

Choose OpenAI Compatible as the API provider, then fill in the base URL, the mxl_ key and the model id. Both forks use the same three fields.

If the model list stays empty, the base URL is usually the cause: these clients read GET /v1/models to populate it, and that route answers without a key — so an empty list means the URL is wrong rather than the key.

Aider #

Aider routes through litellm, which selects a provider from a prefix on the model name. That prefix is the gotcha: openai/ tells litellm to speak the OpenAI protocol, and it is additional to our id rather than a replacement for its publisher segment.

bash
export OPENAI_API_BASE="https://inference.maxlayer.cloud/v1"
export OPENAI_API_KEY="mxl_…"

# The openai/ prefix is litellm's provider selector, not part of the model id.
# Our ids already contain a slash, so both survive: openai/ + anthropic/claude…
aider --model openai/anthropic/claude-sonnet-5

Zed #

Set language_models.openai.api_url in settings.json and declare the models you want offered. Zed needs max_tokens per model — take it from the context window shown on the model's page.

settings.json
{
  "language_models": {
    "openai": {
      "api_url": "https://inference.maxlayer.cloud/v1",
      "available_models": [
        {
          "name": "anthropic/claude-sonnet-5",
          "display_name": "Maxlayer · Llama 3.1 70B",
          "max_tokens": 24000
        }
      ]
    }
  }
}

opencode #

Register Maxlayer as an OpenAI-compatible provider in opencode's configuration, then select one of its models. The shape below is the OpenAI-compatible provider form; check opencode's own documentation if its schema has moved since.

opencode.json
{
  "provider": {
    "maxlayer": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Maxlayer",
      "options": {
        "baseURL": "https://inference.maxlayer.cloud/v1",
        "apiKey": "mxl_…"
      },
      "models": {
        "anthropic/claude-sonnet-5": {
          "name": "Llama 3.1 70B Instruct"
        }
      }
    }
  }
}

Model keys are the catalogue ids verbatim. If a request fails immediately with a message about reaching a control plane or a missing configuration value, that is a deployment-side fault rather than anything in this file — the table below says which.

Anything else #

Most tools read the conventional OpenAI environment variables, and that is enough on its own.

bash
# Anything that reads the conventional OpenAI variables.
export OPENAI_BASE_URL="https://inference.maxlayer.cloud/v1"
export OPENAI_API_KEY="mxl_…"

Several more editors and terminal agents expose an OpenAI-compatible provider and work the same way. They are not given step-by-step configuration here on purpose — these move their settings between releases often enough that a path written down today is a path that misleads somebody next quarter. Look for the setting named below, and give it the same three values.

  • Kilo Code — an OpenAI Compatible provider, like Cline and Roo above, which it shares a lineage with.
  • VS Code Copilot Chat — supports custom model providers through its bring-your-own-key settings, where an OpenAI-compatible endpoint takes a base URL.
  • Xcode — add a custom model provider with an OpenAI-compatible API.
  • Deep Agents CLI and other LangChain-based agents — configured through the model object rather than the tool, so see LangChain.

For libraries rather than editors — LangChain, LlamaIndex, the Vercel AI SDK, PydanticAI — see framework integrations, which carries working configuration for each.

Troubleshooting #

Every message below is one this endpoint actually returns. A few are misleading about their own cause, and those are the ones worth reading first.

What you see What it means What to do
401 · unauthorized No key, a revoked key, or a browser session token used as one. Use an organization key starting mxl_ from Settings → API keys.
402 · insufficient_credit The organization's prepaid balance is spent. Top up. Retrying never clears this, and some clients will retry it as though it were a rate limit.
403 · forbidden The organization is suspended. Contact support. Buying credit will not restore access on its own.
404 · No model with id "…" The id is unknown or it exists and is not listed — the two answer identically on purpose, so the catalogue cannot be enumerated. It is also what a mismatched internal service token looks like. Check the id against GET /v1/models. If the message names the model, that is what it means. A 404 that does not name it is a deployment fault reported as a config_error instead — report it with the request id.
400 · "… is an embedding model" A chat route was called with an embedding model, or the reverse. Configure the two separately. Tools with a codebase index need both.
429 · rate_limited The upstream provider is throttling this model. Retry with backoff. Unlike a 402 this one does clear.
500 · config_error A deployment is missing a setting — the message names it. Nothing to do with your request. Report it with the requestId; it needs fixing on our side.
502 · "Cannot reach the control plane" Authorization could not be performed, so no call was made and nothing was charged. Retry. If it persists, report it with the requestId.
502 · "Inference is temporarily unavailable" A platform-side problem with the upstream, deliberately not passed through as though it were yours. Retry, then report it.

Two checks worth running first #

GET /v1/models needs no key. If it answers, the base URL is right and the problem is the key or the model id. If it does not, nothing else will work either.

bash
curl https://inference.maxlayer.cloud/v1/models

Then the same call with your key against a model id from that list. A 401 means the key, a 404 means the id, and a 402 means the balance — three questions answered by two commands.