Skip to main content

Third-Party Models

This guide explains how to call third-party models configured in the CloudBase console (such as DeepSeek, Zhipu, self-hosted OpenAI-compatible services, third-party image generation services, and more).

Prerequisites

  1. Go to the CloudBase AI Console → select Third-Party Models.
  2. Click Add Model Provider and fill in the Provider Identifier, BaseURL, API Key, and other required fields.
  3. After saving, use the Provider Identifier from the console as the argument when calling the SDK.
tip

For the full setup steps for custom models, see Connect to Models.

Text Models

When calling createModel(), replace the argument with the Provider Identifier from the console. The example below uses my-deepseek:

// 'my-deepseek' is the Provider Identifier configured in the console
const model = ai.createModel("my-deepseek");

const res = await model.generateText({
model: "deepseek-chat", // The actual model name
messages: [
{ role: "user", content: "Tell me about Li Bai" },
],
});

console.log(res.text);

For streaming, use streamText():

const model = ai.createModel("my-deepseek");

const res = await model.streamText({
model: "deepseek-chat",
messages: [{ role: "user", content: "Write a seven-character quatrain" }],
});

for await (const chunk of res.textStream) {
console.log(chunk);
}

For more usage details, see Node SDK.

Image Models

When calling createImageModel(), replace the argument with the Provider Identifier from the console. The example below uses my-image-provider:

const imageModel = ai.createImageModel("my-image-provider");

const res = await imageModel.generateImage({
model: "your-model-name", // The actual model name
prompt: "A cute cat playing on the grass",
});

console.log(res.data[0].url);

For more image generation capabilities, see Node SDK.