Skip to content

feat: add ModelsLab chat provider#280

Open
adhikjoshi wants to merge 1 commit intoandrewyng:mainfrom
adhikjoshi:feat/add-modelslab-provider
Open

feat: add ModelsLab chat provider#280
adhikjoshi wants to merge 1 commit intoandrewyng:mainfrom
adhikjoshi:feat/add-modelslab-provider

Conversation

@adhikjoshi
Copy link

Summary

Adds ModelsLab as an OpenAI-compatible chat provider for aisuite.

ModelsLab provides uncensored chat via their OpenAI-compatible endpoint at https://modelslab.com/api/uncensored-chat/v1.

Usage

export MODELSLAB_API_KEY=your_key
import aisuite as ai

client = ai.Client()
messages = [{"role": "user", "content": "Hello!"}]
response = client.chat.completions.create(
    model="modelslab:meta-llama/Meta-Llama-3-8B-Instruct",
    messages=messages,
)

Implementation

  • Uses the official openai Python client with custom base_url
  • Follows the same pattern as inception_provider.py (OpenAI-compatible providers)
  • Requires MODELSLAB_API_KEY env var or api_key in config

Files Changed

  • aisuite/providers/modelslab_provider.py — new provider (59 lines)

API Details

  • Base URL: https://modelslab.com/api/uncensored-chat/v1
  • Auth: api_key in client config
  • Models: Any model supported by ModelsLab's uncensored chat endpoint
  • Docs: https://docs.modelslab.com

Adds ModelsLab as an OpenAI-compatible chat provider using the
uncensored-chat endpoint at https://modelslab.com/api/uncensored-chat/v1.

Usage:
    export MODELSLAB_API_KEY=your_key

    import aisuite as ai
    client = ai.Client()
    response = client.chat.completions.create(
        model='modelslab:meta-llama/Meta-Llama-3-8B-Instruct',
        messages=[{'role': 'user', 'content': 'Hello!'}],
    )

API docs: https://docs.modelslab.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant