From bae3cee8da7348c36626e4ac6f364b066c49f52f Mon Sep 17 00:00:00 2001 From: Dmitry Date: Mon, 27 Oct 2025 17:38:16 +0200 Subject: [PATCH] feat: Add AI/ML API provider integration Introduces a new provider configuration for AI/ML API by adding aimlapi.json, registering the provider in providers.go, and updating the list of known providers in provider.go. This enables support for multiple new models and expands provider options. --- internal/providers/configs/aimlapi.json | 128 ++++++++++++++++++++++++ internal/providers/providers.go | 8 ++ pkg/catwalk/provider.go | 2 + 3 files changed, 138 insertions(+) create mode 100644 internal/providers/configs/aimlapi.json diff --git a/internal/providers/configs/aimlapi.json b/internal/providers/configs/aimlapi.json new file mode 100644 index 00000000..4c715dad --- /dev/null +++ b/internal/providers/configs/aimlapi.json @@ -0,0 +1,128 @@ +{ + "name": "AI/ML API", + "id": "aimlapi", + "api_key": "$AIMLAPI_API_KEY", + "api_endpoint": "https://api.aimlapi.com/v1", + "type": "openai-compat", + "default_large_model_id": "openai/gpt-5-chat-latest", + "default_small_model_id": "deepseek/deepseek-chat-v3.1", + "models": [ + { + "id": "deepseek/deepseek-chat-v3.1", + "name": "DeepSeek V3.1", + "cost_per_1m_in": 0, + "cost_per_1m_out": 0, + "cost_per_1m_in_cached": 0, + "cost_per_1m_out_cached": 0, + "context_window": 128000, + "default_max_tokens": 8000, + "can_reason": true, + "supports_attachments": true, + "options": {} + }, + { + "id": "openai/gpt-5-chat-latest", + "name": "GPT-5 Chat Latest", + "cost_per_1m_in": 0, + "cost_per_1m_out": 0, + "cost_per_1m_in_cached": 0, + "cost_per_1m_out_cached": 0, + "context_window": 400000, + "default_max_tokens": 16384, + "can_reason": true, + "supports_attachments": true, + "options": {} + }, + { + "id": "deepseek/deepseek-reasoner-v3.1", + "name": "DeepSeek Reasoner V3.1", + "cost_per_1m_in": 0, + "cost_per_1m_out": 0, + "cost_per_1m_in_cached": 0, + "cost_per_1m_out_cached": 0, + "context_window": 128000, + "default_max_tokens": 64000, + "can_reason": true, + "supports_attachments": true, + "options": {} + }, + { + "id": "openai/gpt-4o", + "name": "GPT 4o", + "cost_per_1m_in": 0, + "cost_per_1m_out": 0, + "cost_per_1m_in_cached": 0, + "cost_per_1m_out_cached": 0, + "context_window": 128000, + "default_max_tokens": 16384, + "can_reason": true, + "supports_attachments": true, + "options": {} + }, + { + "id": "gpt-4o-mini", + "name": "GPT 4o mini", + "cost_per_1m_in": 0, + "cost_per_1m_out": 0, + "cost_per_1m_in_cached": 0, + "cost_per_1m_out_cached": 0, + "context_window": 128000, + "default_max_tokens": 16384, + "can_reason": true, + "supports_attachments": true, + "options": {} + }, + { + "id": "google/gemini-2.0-flash-exp", + "name": "Gemini 2.0 Flash Experimental", + "cost_per_1m_in": 0, + "cost_per_1m_out": 0, + "cost_per_1m_in_cached": 0, + "cost_per_1m_out_cached": 0, + "context_window": 1000000, + "default_max_tokens": 8192, + "can_reason": true, + "supports_attachments": true, + "options": {} + }, + { + "id": "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo", + "name": "Meta Llama 3.1 70B Instruct Turbo", + "cost_per_1m_in": 0, + "cost_per_1m_out": 0, + "cost_per_1m_in_cached": 0, + "cost_per_1m_out_cached": 0, + "context_window": 128000, + "default_max_tokens": 127000, + "can_reason": true, + "supports_attachments": false, + "options": {} + }, + { + "id": "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo", + "name": "Meta Llama 3.1 8B Instruct Turbo", + "cost_per_1m_in": 0, + "cost_per_1m_out": 0, + "cost_per_1m_in_cached": 0, + "cost_per_1m_out_cached": 0, + "context_window": 128000, + "default_max_tokens": 127000, + "can_reason": true, + "supports_attachments": false, + "options": {} + }, + { + "id": "Qwen/Qwen2.5-72B-Instruct-Turbo", + "name": "Qwen2.5 72B Instruct Turbo", + "cost_per_1m_in": 0, + "cost_per_1m_out": 0, + "cost_per_1m_in_cached": 0, + "cost_per_1m_out_cached": 0, + "context_window": 32000, + "default_max_tokens": 31000, + "can_reason": true, + "supports_attachments": false, + "options": {} + } + ] +} diff --git a/internal/providers/providers.go b/internal/providers/providers.go index 83b35230..91606a3c 100644 --- a/internal/providers/providers.go +++ b/internal/providers/providers.go @@ -57,6 +57,9 @@ var huggingFaceConfig []byte //go:embed configs/aihubmix.json var aiHubMixConfig []byte +//go:embed configs/aimlapi.json +var aiMLAPIConfig []byte + // ProviderFunc is a function that returns a Provider. type ProviderFunc func() catwalk.Provider @@ -77,6 +80,7 @@ var providerRegistry = []ProviderFunc{ deepSeekProvider, huggingFaceProvider, aiHubMixProvider, + aiMLAPIProvider, } // GetAll returns all registered providers. @@ -160,3 +164,7 @@ func huggingFaceProvider() catwalk.Provider { func aiHubMixProvider() catwalk.Provider { return loadProviderFromConfig(aiHubMixConfig) } + +func aiMLAPIProvider() catwalk.Provider { + return loadProviderFromConfig(aiMLAPIConfig) +} diff --git a/pkg/catwalk/provider.go b/pkg/catwalk/provider.go index 01eb4314..32cb46a2 100644 --- a/pkg/catwalk/provider.go +++ b/pkg/catwalk/provider.go @@ -35,6 +35,7 @@ const ( InferenceProviderChutes InferenceProvider = "chutes" InferenceProviderHuggingFace InferenceProvider = "huggingface" InferenceAIHubMix InferenceProvider = "aihubmix" + InferenceProviderAIMLAPI InferenceProvider = "aimlapi" ) // Provider represents an AI provider configuration. @@ -95,6 +96,7 @@ func KnownProviders() []InferenceProvider { InferenceProviderChutes, InferenceProviderHuggingFace, InferenceAIHubMix, + InferenceProviderAIMLAPI, } }