> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getlilac.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect to local coding tools

> Connect Lilac inference to OpenCode, Continue, Cursor, and other OpenAI-compatible AI coding assistants running in your local development environment.

Lilac is available as a native provider in [OpenCode](https://opencode.ai), so OpenCode is the recommended way to use Lilac in your local coding environment. Lilac's API is also fully OpenAI-compatible, so you can use it with other tools like Continue, Cursor, or any client that supports a custom OpenAI-compatible endpoint.

## Prerequisites

Before you start, make sure you have:

* A Lilac account with credits loaded — [sign up here](https://console.getlilac.com)
* A Lilac API key — [create one in the dashboard](https://console.getlilac.com)
* [OpenCode](https://opencode.ai) or another local coding tool

<Info>
  Don't have an API key yet? See the [API keys](/inference/api-keys) page for instructions on creating and managing keys.
</Info>

## OpenCode

OpenCode ships with Lilac as a built-in provider — no custom JSON config required.

<Steps>
  <Step title="Open OpenCode">
    ```bash theme={null}
    opencode
    ```
  </Step>

  <Step title="Connect to Lilac">
    Type `/connect`.
  </Step>

  <Step title="Choose &#x22;Lilac&#x22;">
    Select **Lilac** from the provider list.
  </Step>

  <Step title="Enter your Lilac API key">
    Paste your Lilac API key from the [dashboard](https://console.getlilac.com).
  </Step>

  <Step title="Choose a model">
    Recommended:

    * GLM 5.2 *(recommended for coding and agents)*
    * Kimi K2.6
    * MiniMax M3
    * Gemma 4 31B IT
  </Step>
</Steps>

### Troubleshooting OpenCode

If Lilac does not show up in OpenCode, refresh the model list:

```bash theme={null}
opencode models lilac --refresh
```

Then restart OpenCode and try `/connect` again.

## Other tools

For tools that don't have a native Lilac integration, use Lilac's OpenAI-compatible endpoint with a custom API configuration.

### What you need to configure

Every tool that supports a custom API will ask you for three things. Here are the exact values to use:

| Setting                     | Value                                                                   |
| --------------------------- | ----------------------------------------------------------------------- |
| **API endpoint / Base URL** | `https://api.getlilac.com/v1`                                           |
| **API key**                 | Your Lilac API key (from the [dashboard](https://console.getlilac.com)) |
| **Model name**              | `moonshotai/kimi-k2.6` *(example — swap for the model you want to use)* |

Model name examples:

* `zai-org/glm-5.2` *(recommended for coding and agents)*
* `moonshotai/kimi-k2.6`
* `minimaxai/minimax-m3`
* `google/gemma-4-31b-it`

<Note>
  `moonshotai/kimi-k2.6` is used as an example throughout this section. Replace it with the full model ID of whichever model you want to use — see [Supported Models](/inference/models) for the complete list.
</Note>

<Warning>
  You must use the **exact** model ID, including any vendor prefix (e.g. `moonshotai/`, `zai-org/`, `google/`, `minimaxai/`). Shorthand names like `glm` or `k2.6` will not work.
</Warning>

### Step-by-step setup

<Steps>
  <Step title="Find your tool's API settings">
    Open your coding tool and look for settings related to **AI provider**, **API configuration**, **custom model**, or **OpenAI-compatible endpoint**. This is usually in the tool's settings or preferences menu.
  </Step>

  <Step title="Set the API endpoint">
    Enter the following as the base URL or API endpoint:

    ```text theme={null}
    https://api.getlilac.com/v1
    ```

    <Warning>
      Make sure you include `/v1` at the end. Omitting it will cause requests to fail.
    </Warning>
  </Step>

  <Step title="Enter your API key">
    Paste your Lilac API key into the API key field. This is the key you copied when you created it in the [dashboard](https://console.getlilac.com).

    <Tip>
      Store your API key as an environment variable (e.g., `LILAC_API_KEY`) rather than pasting it directly into config files that might get committed to version control.
    </Tip>
  </Step>

  <Step title="Set the model name">
    Enter the full model ID for the model you want to use. For example:

    ```text theme={null}
    moonshotai/kimi-k2.6
    ```

    `moonshotai/kimi-k2.6` is just an example — replace it with the ID of whichever model you want to use (e.g. `zai-org/glm-5.2`, `minimaxai/minimax-m3`, `google/gemma-4-31b-it`). See [Supported Models](/inference/models) for the full list. Do not omit or change any part of the identifier, including the vendor prefix.
  </Step>

  <Step title="Test the connection">
    Send a test message to confirm everything is working. If you get a response, you're all set.

    If you get an error, double-check:

    1. The base URL is exactly `https://api.getlilac.com/v1` (with `/v1`)
    2. Your API key is correct and hasn't been revoked
    3. The model name is the exact full identifier of a [supported model](/inference/models) (e.g. `moonshotai/kimi-k2.6`)
    4. Your account has a positive credit balance
  </Step>
</Steps>

### Quick reference

If your tool uses a config file or environment variables, here's what to set:

```bash theme={null}
# Environment variables
export OPENAI_API_BASE=https://api.getlilac.com/v1
export OPENAI_API_KEY=your-lilac-api-key
```

```json theme={null}
{
  "apiBase": "https://api.getlilac.com/v1",
  "apiKey": "your-lilac-api-key",
  "model": "moonshotai/kimi-k2.6"
}
```

<Note>
  `moonshotai/kimi-k2.6` is shown here as an example. Substitute the full ID of the model you want to use — see [Supported Models](/inference/models).
</Note>

<Note>
  Variable names differ by tool. The examples above use common conventions — check your tool's documentation for the exact names.
</Note>

## Common issues

<AccordionGroup>
  <Accordion title="Lilac does not appear in OpenCode">
    Run `opencode models lilac --refresh`, then restart OpenCode and try `/connect` again.
  </Accordion>

  <Accordion title="401 Unauthorized">
    Your API key is missing, incorrect, or has been revoked. Generate a new key from the [dashboard](https://console.getlilac.com) and try again.
  </Accordion>

  <Accordion title="404 Not Found">
    The base URL is likely wrong. Make sure it is `https://api.getlilac.com/v1` — including the `/v1` path.
  </Accordion>

  <Accordion title="Model not found">
    The model name must be the full identifier of a [supported model](/inference/models) — for example `moonshotai/kimi-k2.6`. Check for typos, extra spaces, or a missing vendor prefix.
  </Accordion>

  <Accordion title="Connection timeout or refused">
    Confirm your machine has internet access and that no firewall or proxy is blocking requests to `api.getlilac.com`.
  </Accordion>

  <Accordion title="Insufficient credits">
    Your account balance is zero. Add credits in the [dashboard billing page](https://console.getlilac.com) before making requests.
  </Accordion>
</AccordionGroup>
