> For the complete documentation index, see [llms.txt](https://modelmesh.gitbook.io/cline-zhong-wen-ban-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://modelmesh.gitbook.io/cline-zhong-wen-ban-docs/litellm-and-cline-using-codestral.md).

# LiteLLM & Cline (using Codestral)

#### Using LiteLLM with Cline <a href="#using-litellm-with-cline" id="using-litellm-with-cline"></a>

This guide demonstrates how to run a demo for LiteLLM starting with the Codestral model for use with Cline.

**Prerequisites**

* [Docker CLI or Docker Desktop](https://www.docker.com/get-started/) installed to run the LiteLLM image locally
* For this example config: A Codestral API Key (different from the Mistral API Keys)

**Setup**

1. **Create a `.env` file and fill in the appropriate field**

Copy

```
# Tip: Use the following command to generate a random alphanumeric key:
# openssl rand -base64 32 | tr -dc 'A-Za-z0-9' | head -c 32
LITELLM_MASTER_KEY=YOUR_LITELLM_MASTER_KEY
CODESTRAL_API_KEY=YOUR_CODESTRAL_API_KEY
```

*Note: Although this is limited to localhost, it's a good practice set LITELLM\_MASTER\_KEY to something secure*

1. **Configuration**

We'll need to create a `config.yaml` file to contain our LiteLLM configuration. In this case we'll just have one model, 'codestral-latest' and label it 'codestral'

Copy

```
model_list:
  - model_name: codestral
    litellm_params:
      model: codestral/codestral-latest
      api_key: os.environ/CODESTRAL_API_KEY
```

**Running the Demo**

1. **Startup the LiteLLM docker container**

Copy

```
docker run \
    --env-file .env \
    -v $(pwd)/config.yaml:/app/config.yaml \
    -p 127.0.0.1:4000:4000 \
    ghcr.io/berriai/litellm:main-latest \
    --config /app/config.yaml --detailed_debug
```

1. **Setup Cline**

   Once the LiteLLM server is up and running you can set it up in Cline:

   * Base URL should be `http://0.0.0.0:4000/v1`
   * API Key should be the one you set in `.env` for LITELLM\_MASTER\_KEY
   * Model ID is `codestral` or whatever you named it under `config.yaml`

**Getting Help**

* [LiteLLM Documentation](https://docs.litellm.ai/)
* [Mistral AI Console](https://console.mistral.ai/)
* [Cline Discord Community](https://discord.gg/cline)

Author: mdp


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://modelmesh.gitbook.io/cline-zhong-wen-ban-docs/litellm-and-cline-using-codestral.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
