From db5215e07925fc6169e4a3dde9caae86abd2cbe9 Mon Sep 17 00:00:00 2001 From: Emmanuel Acheampong Date: Mon, 13 Jul 2026 10:08:53 -0700 Subject: [PATCH] feat: add Crusoe provider Adds Crusoe Cloud managed inference as a provider using the OpenAI-compatible base config. Supports chatComplete and complete via https://api.inference.crusoecloud.com/v1. --- src/data/providers.json | 7 +++++++ src/globals.ts | 2 ++ src/providers/crusoe/api.ts | 24 ++++++++++++++++++++++++ src/providers/crusoe/index.ts | 22 ++++++++++++++++++++++ src/providers/index.ts | 4 +++- 5 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 src/providers/crusoe/api.ts create mode 100644 src/providers/crusoe/index.ts diff --git a/src/data/providers.json b/src/data/providers.json index fd801fdc5..31297981c 100644 --- a/src/data/providers.json +++ b/src/data/providers.json @@ -323,6 +323,13 @@ "object": "provider", "description": "Dashscope provides intelligent analytics solutions designed to help businesses visualize and interpret complex data effectively. Their platform integrates advanced machine learning algorithms to generate real-time insights from diverse datasets, enabling organizations to make informed decisions quickly. Dashscope focuses on enhancing data accessibility and usability, empowering teams to leverage analytics for strategic planning and operational efficiency.", "base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1" + }, + { + "id": "crusoe", + "name": "Crusoe", + "object": "provider", + "description": "Crusoe Cloud provides managed inference for open-weight AI models on sustainable, energy-efficient data centers. Their OpenAI-compatible API offers access to leading open-source models such as Llama, DeepSeek, and Qwen, with a focus on high performance and reliability.", + "base_url": "https://api.inference.crusoecloud.com/v1" } ] } diff --git a/src/globals.ts b/src/globals.ts index 4d6e327e4..41adaa5e1 100644 --- a/src/globals.ts +++ b/src/globals.ts @@ -113,6 +113,7 @@ export const ORACLE: string = 'oracle'; export const IO_INTELLIGENCE: string = 'iointelligence'; export const AIBADGR: string = 'aibadgr'; export const OVHCLOUD: string = 'ovhcloud'; +export const CRUSOE: string = 'crusoe'; export const VALID_PROVIDERS = [ ANTHROPIC, @@ -189,6 +190,7 @@ export const VALID_PROVIDERS = [ IO_INTELLIGENCE, AIBADGR, OVHCLOUD, + CRUSOE, ]; export const CONTENT_TYPES = { diff --git a/src/providers/crusoe/api.ts b/src/providers/crusoe/api.ts new file mode 100644 index 000000000..a1dd28e80 --- /dev/null +++ b/src/providers/crusoe/api.ts @@ -0,0 +1,24 @@ +import { ProviderAPIConfig } from '../types'; + +export const CrusoeAPIConfig: ProviderAPIConfig = { + getBaseURL: () => 'https://api.inference.crusoecloud.com/v1', + headers({ providerOptions }) { + const { apiKey } = providerOptions; + const headers = { + Authorization: `Bearer ${apiKey}`, + }; + return headers; + }, + getEndpoint({ fn }) { + switch (fn) { + case 'chatComplete': { + return '/chat/completions'; + } + case 'complete': { + return '/completions'; + } + default: + return ''; + } + }, +}; diff --git a/src/providers/crusoe/index.ts b/src/providers/crusoe/index.ts new file mode 100644 index 000000000..190639d30 --- /dev/null +++ b/src/providers/crusoe/index.ts @@ -0,0 +1,22 @@ +import { CRUSOE } from '../../globals'; +import { + chatCompleteParams, + completeParams, + responseTransformers, +} from '../open-ai-base'; +import { ProviderConfigs } from '../types'; +import { CrusoeAPIConfig } from './api'; + +export const CrusoeProviderConfig: ProviderConfigs = { + chatComplete: chatCompleteParams([], { + model: 'meta-llama/Llama-3.3-70B-Instruct', + }), + complete: completeParams([], { + model: 'meta-llama/Llama-3.3-70B-Instruct', + }), + api: CrusoeAPIConfig, + responseTransforms: responseTransformers(CRUSOE, { + chatComplete: true, + complete: true, + }), +}; diff --git a/src/providers/index.ts b/src/providers/index.ts index 2cd5355f8..b7dca07ff 100644 --- a/src/providers/index.ts +++ b/src/providers/index.ts @@ -46,7 +46,7 @@ import { InferenceNetProviderConfigs } from './inference-net'; import SambaNovaConfig from './sambanova'; import LemonfoxAIConfig from './lemonfox-ai'; import { UpstageConfig } from './upstage'; -import { LAMBDA } from '../globals'; +import { LAMBDA, CRUSOE } from '../globals'; import { LambdaProviderConfig } from './lambda'; import { DashScopeConfig } from './dashscope'; import XAIConfig from './x-ai'; @@ -74,6 +74,7 @@ import OracleConfig from './oracle'; import IOIntelligenceConfig from './iointelligence'; import AIBadgrConfig from './aibadgr'; import OVHcloudConfig from './ovhcloud'; +import { CrusoeProviderConfig } from './crusoe'; const Providers: { [key: string]: ProviderConfigs } = { openai: OpenAIConfig, @@ -148,6 +149,7 @@ const Providers: { [key: string]: ProviderConfigs } = { iointelligence: IOIntelligenceConfig, aibadgr: AIBadgrConfig, ovhcloud: OVHcloudConfig, + [CRUSOE]: CrusoeProviderConfig, }; export default Providers;