Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add more predefined OpenAI-compatible provider templates #637

Description

@haiphucnguyen

Summary

We currently have 5 predefined templates in OpenAiCompatibleTemplate.kt:

  • Cloudflare AI, Groq, NVIDIA NIM, OpenRouter, Together AI

This issue tracks adding more popular cloud AI providers as predefined templates so users can connect them in one click without needing to know the API URL.

Background

A template is a simple enum entry - no new factory, no new ModelProvider enum value needed. The minimum required fields are:

PROVIDER_NAME(
    displayName = "Provider Name",
    initials = "PN",           // 2-letter badge shown in the UI
    taglineKey = "provider.template.provider_name.tagline",   // i18n key
    baseUrl = "https://api.provider.com/v1",
    apiKeyRequired = true,
    apiKeyUrl = "https://provider.com/get-api-key",
    helpTextKey = "provider.template.provider_name.help",     // i18n key
    // optional overrides:
    // apiMode = OpenAiApiMode.RESPONSES,
    // httpVersion = HttpVersion.HTTP_1_1,
    // modelFetcher = { apiKey, baseUrl, httpVersion -> ... },
)

You also need to add the i18n strings to the strings resource file(s).

Providers to Add

Tier 1 - Straightforward (standard /models endpoint, no custom fetcher needed)

Status Enum name displayName initials baseUrl apiKeyUrl Contributors
Active MISTRAL Mistral AI MI https://api.mistral.ai/v1 https://console.mistral.ai/api-keys
Resolved DEEPSEEK DeepSeek DS https://api.deepseek.com/v1 https://platform.deepseek.com/api_keys @Gambit-Checkmate
Active PERPLEXITY Perplexity AI PX https://api.perplexity.ai https://www.perplexity.ai/settings/api
Active COHERE Cohere CO https://api.cohere.com/compatibility/v1 https://dashboard.cohere.com/api-keys
Active FIREWORKS_AI Fireworks AI FW https://api.fireworks.ai/inference/v1 https://fireworks.ai/account/api-keys
Active CEREBRAS Cerebras CB https://api.cerebras.ai/v1 https://cloud.cerebras.ai/platform/api-keys
Active SAMBANOVA SambaNova SN https://api.sambanova.ai/v1 https://cloud.sambanova.ai
Active AI21 AI21 Labs A2 https://api.ai21.com/studio/v1 https://studio.ai21.com/account/api-key
Active HYPERBOLIC Hyperbolic HY https://api.hyperbolic.xyz/v1 https://app.hyperbolic.xyz/settings

Tier 2 - Needs a custom modelFetcher

Hugging Face - the standard /models endpoint returns millions of models. A custom fetcher should query the warm serverless inference models only:

HUGGING_FACE(
    displayName = "Hugging Face",
    initials = "HF",
    taglineKey = "provider.template.hugging_face.tagline",
    baseUrl = "https://api-inference.huggingface.co/v1",
    apiKeyRequired = true,
    apiKeyUrl = "https://huggingface.co/settings/tokens",
    helpTextKey = "provider.template.hugging_face.help",
    modelFetcher = { apiKey, baseUrl, httpVersion ->
        val url = "https://huggingface.co/api/models?inference=warm&pipeline_tag=text-generation&limit=100"
        val (_, body) = httpGet(url, headers = mapOf("Authorization" to "Bearer $apiKey"), httpVersion = httpVersion)
        val json = appJson.parseToJsonElement(body)
        json.jsonArray
            .mapNotNull { it.jsonObject["id"]?.jsonPrimitive?.contentOrNull }
            .distinct()
            .sorted()
    },
)

i18n Strings Required

For each provider you add, you must add two i18n keys:

  • provider.template.{name}.tagline : one sentence: what makes this provider useful
  • provider.template.{name}.help : 2–3 sentences: how to get an API key and any setup notes
    Find the existing strings files and follow the pattern of existing entries like provider.template.groq.tagline.

💡 Want to contribute?

Pick any provider from the table above that hasn't been claimed yet and leave a comment below so others know you're working on > it. The list above is a starting point - if you know a public cloud AI provider that exposes an OpenAI-compatible endpoint and isn't > listed here, feel free to propose it in the comments or include it directly in your PR.

Before submitting a PR, please make sure you:

  • Have an active account and a real API key for the provider you're adding
  • Successfully loaded the model list in the app (the model picker shows actual models, not an error)
  • Sent at least one test message using the provider and received a valid response

PRs without a confirmed working test will not be merged. A short note in the PR description like "Tested with Mistral AI, loaded 10 models, chat works ✓" is sufficient.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions