# Chat Completions

# Source-specific instructions

# OpenAI

Use OpenAI's developer platform to access various OpenAI models, including gpt-4o, gpt-4.1, o3, etc.

How to get an API key:

  1. Go to OpenAI and sign in.
  2. Use "View API keys" option to create a new API key.

# Claude

Claude is a family of AI models developed by Anthropic. You can access Claude models through the Anthropic console.

How to get an API key:

  1. Go to Anthropic Console and sign in.
  2. Use the "Get API Key" section to create a new API key.

# Mistral AI

Mistral AI is a team developing both open and proprietary models with high scientific standards and a focus on openness. You can run their models locally or through their API service, La Plateforme.

How to get an API key:

  1. The first step is to create an account on La Plateforme.
  2. Once that's done, you can choose a plan and set up your payment information or opt for the Free Tier.
  3. Next, you can create your API key. You may need to wait a couple of minutes before the key becomes valid!

# DeepSeek

DeepSeek Platform provides access to the latest DeepSeek models through an API. They offer a range of models, including DeepSeek V3 and DeepSeek R1.

How to get an API key:

  1. Sign up on the DeepSeek Platform.
  2. After signing up and topping up your account, you can create an API key in the "API keys" section.

# AI21

AI21 Labs offers a range of AI models, including their flagship Jamba series. You can access their models through the AI21 Studio API.

How to get an API key:

  1. Go to AI21 Studio and sign in.
  2. Navigate to the "Settings => API Keys" section to create a new API key.

# Cohere

Cohere provides a suite of AI models for various tasks, including text generation and embeddings. You can access their models through the Cohere API.

How to get an API key:

  1. Go to Cohere and sign in.
  2. Navigate to the "API Keys" section in your account settings to create a new API key.

# Perplexity

Perplexity AI offers access to online-enabled Sonar models through their API for real-time research and information retrieval.

Official Getting Started guide: Perplexity Quickstart

How to get an API key:

  1. Go to Perplexity and sign in.
  2. Go to the "API billing" section to purchase credits for API usage.
  3. Navigate to the "API keys" section in the settings to create a new API key.

# Fireworks AI

Fireworks AI is a high-performance platform that provides fast, cost-effective access to state-of-the-art open-source language models. The platform offers serverless deployment with OpenAI-compatible APIs and supports context windows up to 256,000 tokens.

How to get an API key:

  1. Go to Fireworks AI and create an account or sign in.
  2. Navigate to the API Keys page in your account settings.
  3. Click "Create API key" and provide a descriptive name (e.g., "SillyTavern").

# Electron Hub

Electron Hub is a unified OpenAI-compatible platform that provides access to models from multiple vendors through a single API key.

How to get an API key:

  1. Create an account at Electron Hub.
  2. Generate an API key from the Console → API Keys page.

# Custom OpenAI-compatible endpoint

You can configure an alternative endpoint for the Chat Completions backend. This custom endpoint can connect to any server that supports the generic OpenAI API schema.

Examples of compatible backends include:

# Connecting

To access this feature:

  1. Switch to the 'Chat Completion' API type
  2. Select 'Custom (OpenAI-compatible)' for 'Chat Completion Source'

Enter the custom endpoint URL and an API key if required. For example, TabbyAPI requires an API key for authentication.

# Selecting a Model

If the custom API implements the /v1/models endpoint to provide a list of available models, you can choose from a dropdown list. Otherwise, use the text field to manually input a model ID.

Check 'Bypass API status check' to prevent SillyTavern from alerting you about a non-functioning API endpoint. Enable this option if your API endpoint works properly but SillyTavern continues to display warnings.

Click "Test Message" to verify connectivity by sending a simple prompt to the model.

# Prompt Post-Processing

Some endpoints may impose specific restrictions on the format of incoming prompts, such as requiring only one system message or strictly alternating roles.

SillyTavern provides built-in prompt converters to help meet these requirements (from least to most restrictive):

  1. None - no explicit processing applied unless strictly required by the API
  2. Merge consecutive messages from the same role
  3. Semi-strict - merge roles and allow only one optional system message
  4. Strict - merge roles, allow only one optional system message, and require a user message to be first
  5. Single user message - merge all messages from all roles into a single user message

Merge, semi-strict, and strict additionally remove any tool calls from the prompt, unless the "with tools" variant is selected. This is useful for APIs that do not support tool calling and your existing prompts contain tool calls.

Less restrictive options have no effect on more restrictive endpoints implemented in SillyTavern other than "Custom OpenAI-compatible"; Custom may error upon invalid request.

In strict mode, if no user message exists before the first assistant message, then promptPlaceholder from config.yaml will be inserted, which by default is "[Start a new chat]".