Skip to main content

Crusoe

还没翻译译自英文(ai-sdk.dev)本页 20 段都还没译

crusoe-ai-provider contains language model support for Crusoe Cloud Managed Inference, which provides access to open-weight models such as DeepSeek, GLM, Kimi, Llama, Nemotron, and Qwen on sustainable, energy-efficient data centers via an OpenAI-compatible API.

API keys can be obtained from the Crusoe Cloud Console.

Setup

The Crusoe provider is available via the crusoe-ai-provider module. You can install it with:

pnpm add crusoe-ai-provider
npm install crusoe-ai-provider
yarn add crusoe-ai-provider
bun add crusoe-ai-provider

Environment variables

Create a .env file with a CRUSOE_API_KEY variable.

Provider Instance

You can import the default provider instance crusoe from crusoe-ai-provider:

import { crusoe } from 'crusoe-ai-provider';

If you need a customized setup, you can import createCrusoe from crusoe-ai-provider and create a provider instance with your settings:

import { createCrusoe } from 'crusoe-ai-provider';

const crusoe = createCrusoe({
  // Optional settings
});

You can use the following optional settings to customize the Crusoe provider instance:

  • baseURL string

    Use a different URL prefix for API calls, e.g. to use proxy servers. The default prefix is https://api.inference.crusoecloud.com/v1.

  • apiKey string

    API key that is being sent using the Authorization header. It defaults to the CRUSOE_API_KEY environment variable.

  • headers Record<string,string>

    Custom headers to include in the requests.

  • fetch (input: RequestInfo, init?: RequestInit) => Promise<Response>

    Custom fetch implementation. Defaults to the global fetch function.

Language Models

You can create language models using a provider instance:

import { crusoe } from 'crusoe-ai-provider';
import { generateText } from 'ai';

const { text } = await generateText({
  model: crusoe('zai/GLM-5.2'),
  prompt: 'Write a vegetarian lasagna recipe for 4 people.',
});

Crusoe language models can also be used in the streamText function:

import { crusoe } from 'crusoe-ai-provider';
import { streamText } from 'ai';

const result = streamText({
  model: crusoe('deepseek-ai/DeepSeek-V4-Pro'),
  prompt: 'Write a haiku about sustainable computing.',
});

for await (const chunk of result.textStream) {
  process.stdout.write(chunk);
}

Model Capabilities

ModelText GenerationStreaming
deepseek-ai/DeepSeek-V3-0324✓✓
deepseek-ai/DeepSeek-V4-Pro✓✓
deepseek-ai/Deepseek-V4-Flash✓✓
google/gemma-4-31b-it✓✓
meta-llama/Llama-3.3-70B-Instruct✓✓
moonshotai/Kimi-K2.6✓✓
nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B✓✓
nvidia/Nemotron-3-Nano-Omni-Reasoning-30B-A3B✓✓
nvidia/NVIDIA-Nemotron-3-Super-120B-A12B✓✓
nvidia/NVIDIA-Nemotron-3-Ultra-550B✓✓
openai/gpt-oss-120b✓✓
Qwen/Qwen3-235B-A22B-Instruct-2507✓✓
zai/GLM-5.1✓✓
zai/GLM-5.2✓✓

Note

The table above lists popular models. Please see the Crusoe Managed Inference docs for the full list of available models. Any model ID available on Crusoe can be passed as a plain string.