Skip to main content
Before starting this guide, ensure you have completed the Installation Guide and installed all required dependencies.

Setup WatsonX

To set up WatsonX, follow these steps:
  1. Access WatsonX:
    • Sign up for WatsonX.ai.
    • Create an API_KEY and PROJECT_ID.
  2. Validate WatsonX API Access:
    • Verify access using the following commands:
Tip: Verify access to watsonX APIs before installing LiteLLM. Get Session Token:
Get list of LLMs:
Ask the LLM a question:
With access to watsonX API’s validated you can install the python library from here.

Run LiteLLM as a Docker Container

To connect LiteLLM with an WatsonX models, configure your litellm_config.yaml. Example 1:
Example 2:
Before starting the container, ensure you have correctly set the following environment variables:
  • WATSONX_API_KEY
  • WATSONX_URL
  • WX_PROJECT_ID
Run the container using:

Initiate Chat

To communicate with LiteLLM, configure the models in phi1 and phi2 and initiate a chat session.