askimo icon indicating copy to clipboard operation
askimo copied to clipboard

Add more predefined OpenAI-compatible provider templates

Open haiphucnguyen opened this issue 3 months ago • 3 comments

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.

haiphucnguyen avatar Aug 14 '26 01:08 haiphucnguyen

我想认领这个 issue,先做一个 Tier 1 provider,比如 DeepSeek 或 Mistral。我会按现有模板补 enum 和 i18n 文案,再用自己的测试账号验证模型列表和一条消息。可以分给我吗?

Gambit-Checkmate avatar Aug 21 '26 12:08 Gambit-Checkmate

Assigned! Welcome aboard, and looking forward to your PR.

已分配!欢迎参与,期待你的 PR。

haiphucnguyen avatar Aug 21 '26 16:08 haiphucnguyen

I'd like to take this. I would add new provider entries to OpenAiCompatibleTemplate.kt with display name, initials, tagline and help i18n keys, base URL and API key URL, plus the matching i18n strings, and verify each one connects and lists models with screenshots of the template picker. Which providers would you like added, or should I post a short list here first so it doesn't overlap with other contributors?

conka8 avatar Oct 21 '26 23:10 conka8