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

# Using with Coding Tools

> Use ModelsLab's LLM API with Claude Code, Hermes Agent, Pi, OpenAI Codex, Cursor, Continue, Aider, and other AI coding assistants.

ModelsLab's LLM API is compatible with popular AI coding tools. Since it supports both OpenAI and Anthropic API formats, you can use it as a drop-in backend for most AI coding assistants.

Choose any model ID available on the [ModelsLab LLM catalog](https://modelslab.com/models/category/llmaster) or through the [List Models](/llm-api/list-models) endpoint. In the examples below, replace `YOUR_MODEL_ID` with the model you want to use.

## Choose your coding agent

<CardGroup cols={3}>
  <Card title="Claude Code" icon="terminal" img="/images/llm-api/claude-code-card.jpg" href="#claude-code">
    Use ModelsLab as Claude Code's Anthropic-compatible provider.
  </Card>

  <Card title="Hermes Agent" icon="robot" img="/images/llm-api/hermes-agent-card.png" href="#hermes-agent">
    Configure ModelsLab as a custom OpenAI-compatible model provider.
  </Card>

  <Card title="Pi" icon="code" img="/images/llm-api/pi-card.png" href="#pi">
    Add ModelsLab models through Pi's custom provider configuration.
  </Card>
</CardGroup>

## Claude Code

[Claude Code](https://docs.anthropic.com/en/docs/claude-code) is Anthropic's agentic CLI coding tool. You can point it at ModelsLab's API to use any of 200+ LLM models.

### Quick Start

Run any supported model through Claude Code using ModelsLab as the API provider. `ANTHROPIC_AUTH_TOKEN` is preferred for interactive sessions. Use `--model` or `/model` to switch model IDs.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
CLAUDE_CODE_ATTRIBUTION_HEADER=0 \
ANTHROPIC_BASE_URL="https://modelslab.com/api/v7/llm" \
ANTHROPIC_AUTH_TOKEN="YOUR_MODELSLAB_API_KEY" \
claude --model "YOUR_MODEL_ID" --dangerously-skip-permissions
```

### Persistent Configuration

Add to your shell profile (`~/.bashrc`, `~/.zshrc`, etc.):

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
export ANTHROPIC_BASE_URL="https://modelslab.com/api/v7/llm"
export ANTHROPIC_AUTH_TOKEN="YOUR_MODELSLAB_API_KEY"
```

Then run Claude Code with any model:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
claude --model "Qwen/Qwen2.5-VL-72B-Instruct-together"
claude --model "meta-llama/Llama-3.1-70B-Instruct"
claude --model "deepseek-ai/DeepSeek-R1"
```

### Non-Interactive / Scripting

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
ANTHROPIC_BASE_URL="https://modelslab.com/api/v7/llm" \
ANTHROPIC_AUTH_TOKEN="YOUR_MODELSLAB_API_KEY" \
claude --model "Qwen/Qwen2.5-VL-72B-Instruct-together" \
  -p "Explain this codebase" \
  --dangerously-skip-permissions
```

***

## Hermes Agent

[Hermes Agent](https://hermes-agent.nousresearch.com/) is Nous Research's open-source agent. Configure its custom OpenAI-compatible provider to run ModelsLab models.

### Quick Start

Run Hermes with the ModelsLab base URL, API key, and your selected model:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
OPENAI_BASE_URL="https://modelslab.com/api/v7/llm" \
OPENAI_API_KEY="YOUR_MODELSLAB_API_KEY" \
hermes --provider custom --model "YOUR_MODEL_ID"
```

### Persistent Configuration

Save the custom provider settings so future Hermes sessions use ModelsLab automatically:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
hermes config set model.provider custom
hermes config set model.base_url "https://modelslab.com/api/v7/llm"
hermes config set OPENAI_API_KEY "YOUR_MODELSLAB_API_KEY"
hermes config set model.default "YOUR_MODEL_ID"
```

Then start Hermes:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
hermes
```

Use `hermes model` to select another configured model whenever you need to switch.

***

## Pi

[Pi](https://pi.dev) is a terminal coding agent that supports custom OpenAI-compatible providers. Add ModelsLab to Pi's model configuration, then select it from Pi's model picker.

### Configuration

Create or update `~/.pi/agent/models.json`:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "providers": {
    "modelslab": {
      "baseUrl": "https://modelslab.com/api/v7/llm",
      "api": "openai-completions",
      "apiKey": "$MODELSLAB_API_KEY",
      "models": [
        {
          "id": "YOUR_MODEL_ID",
          "name": "Your ModelsLab model",
          "reasoning": true,
          "input": ["text"],
          "contextWindow": 128000,
          "maxTokens": 16384
        }
      ]
    }
  }
}
```

Set your API key and start Pi:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
export MODELSLAB_API_KEY="YOUR_MODELSLAB_API_KEY"
pi --provider modelslab --model "YOUR_MODEL_ID"
```

You can add additional ModelsLab model IDs to the `models` array. Open `/model` in Pi to choose between the configured models.

***

## OpenAI Codex CLI

[Codex CLI](https://github.com/openai/codex) is OpenAI's open-source coding agent. It works with any OpenAI-compatible API.

### Setup

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
OPENAI_API_KEY="YOUR_MODELSLAB_API_KEY" \
OPENAI_BASE_URL="https://modelslab.com/api/v7/llm" \
codex --model "Qwen/Qwen2.5-VL-72B-Instruct-together"
```

### With Environment Variables

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
export OPENAI_API_KEY="YOUR_MODELSLAB_API_KEY"
export OPENAI_BASE_URL="https://modelslab.com/api/v7/llm"

codex --model "Qwen/Qwen2.5-VL-72B-Instruct-together" "refactor this function"
```

***

## Cursor

[Cursor](https://cursor.sh) is an AI-powered code editor. You can configure it to use ModelsLab as a custom OpenAI-compatible provider.

### Setup

1. Open Cursor Settings (`Cmd+,` / `Ctrl+,`)
2. Go to **Models** > **OpenAI API Key**
3. Set your API key to your ModelsLab API key
4. Set the base URL to `https://modelslab.com/api/v7/llm`
5. Add your preferred model IDs (e.g., `Qwen/Qwen2.5-VL-72B-Instruct-together`)

You can now select ModelsLab models from Cursor's model dropdown.

***

## Continue (VS Code / JetBrains)

[Continue](https://continue.dev) is an open-source AI code assistant for VS Code and JetBrains.

### Configuration

Edit your `~/.continue/config.yaml`:

```yaml theme={"theme":{"light":"github-light","dark":"github-dark"}}
models:
  - name: ModelsLab Qwen 72B
    provider: openai
    model: Qwen/Qwen2.5-VL-72B-Instruct-together
    apiBase: https://modelslab.com/api/v7/llm
    apiKey: YOUR_MODELSLAB_API_KEY

  - name: ModelsLab DeepSeek R1
    provider: openai
    model: deepseek-ai/DeepSeek-R1
    apiBase: https://modelslab.com/api/v7/llm
    apiKey: YOUR_MODELSLAB_API_KEY
```

***

## Aider

[Aider](https://aider.chat) is a terminal-based AI pair programming tool.

### Setup

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
OPENAI_API_KEY="YOUR_MODELSLAB_API_KEY" \
OPENAI_API_BASE="https://modelslab.com/api/v7/llm" \
aider --model "openai/Qwen/Qwen2.5-VL-72B-Instruct-together"
```

### With `.aider.conf.yml`

```yaml theme={"theme":{"light":"github-light","dark":"github-dark"}}
openai-api-key: YOUR_MODELSLAB_API_KEY
openai-api-base: https://modelslab.com/api/v7/llm
model: openai/Qwen/Qwen2.5-VL-72B-Instruct-together
```

***

## LangChain

Use ModelsLab as the LLM backend in your LangChain applications:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="Qwen/Qwen2.5-VL-72B-Instruct-together",
    openai_api_key="YOUR_MODELSLAB_API_KEY",
    openai_api_base="https://modelslab.com/api/v7/llm",
    temperature=0.7,
)

response = llm.invoke("Explain the Builder pattern in Python")
print(response.content)
```

***

## LiteLLM

[LiteLLM](https://litellm.ai) provides a unified API for 100+ LLM providers. Add ModelsLab as a custom provider:

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import litellm

response = litellm.completion(
    model="openai/Qwen/Qwen2.5-VL-72B-Instruct-together",
    messages=[{"role": "user", "content": "Hello!"}],
    api_key="YOUR_MODELSLAB_API_KEY",
    api_base="https://modelslab.com/api/v7/llm",
)

print(response.choices[0].message.content)
```

***

## General OpenAI-Compatible Tools

Any tool that supports a custom OpenAI base URL works with ModelsLab:

| Setting | Value |
| - | - |
| **API Key** | Your ModelsLab API key |
| **Base URL** | `https://modelslab.com/api/v7/llm` |
| **Model** | Any model from [List Models](/llm-api/list-models) |

<Tip>
  Browse all available models at [modelslab.com/models/category/llmaster](https://modelslab.com/models/category/llmaster) and use the model ID directly in any compatible tool.
</Tip>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.