Skip to main content
The scaleway provider targets the OpenAI-compatible API exposed by Scaleway AI. It works seamlessly with AI Kit agents and workflows.

Installation

pnpm add @ai_kit/core @ai-sdk/openai ai

Configuration

export SCALEWAY_API_KEY="skw-..."
Retrieve the key from the Scaleway console.

Use with an agent

import { Agent, scaleway } from "@ai_kit/core";

const assistant = new Agent({
  name: "scaleway-assistant",
  instructions: "You are a helpful and accurate assistant.",
  model: scaleway("gpt-oss-120b"),
});

const result = await assistant.generate({
  prompt: "What is the capital of France?",
});

console.log(result.text);

Available models

ModelDescriptionSize
gpt-oss-120bHigh-performing general model120B
llama-3.3-70b-instructMeta Llama 3.3 tuned for instruction70B
llama-3.1-8b-instructCompact Llama 3.18B
mistral-small-3.2-24b-instruct-2506Latest Mistral Small24B
mistral-nemo-instruct-2407Mistral Nemo optimised12B
qwen3-235b-a22b-instruct-2507Large Qwen 3235B
qwen3-coder-30b-a3b-instructQwen 3 code-specialised30B
deepseek-r1-distill-llama-70bDistilled DeepSeek R170B
gemma-3-27b-itGoogle Gemma 3 instruction27B
voxtral-small-24b-2507Voxtral Small24B
devstral-small-2505Devstral for development use cases25B
pixtral-12b-2409Multimodal Pixtral12B

Examples

Structured output

import { Agent, scaleway, Output } from "@ai_kit/core";
import { z } from "zod";

const codeSchema = Output.object({
  schema: z.object({
    language: z.string(),
    code: z.string(),
    explanation: z.string(),
  }),
});

const assistant = new Agent({
  name: "code-assistant",
  instructions: "You are a programming expert.",
  model: scaleway("qwen3-coder-30b-a3b-instruct"),
});

const result = await assistant.generate({
  prompt: "Write a Python function for the Fibonacci sequence.",
  structuredOutput: codeSchema,
});

console.log(result.experimental_output);

Inside a workflow

import { Agent, createStep, createWorkflow, scaleway } from "@ai_kit/core";
import { z } from "zod";

const assistant = new Agent({
  name: "analyzer",
  instructions: "Analyse the sentiment of the text.",
  model: scaleway("mistral-small-3.2-24b-instruct-2506"),
});

const analyzeStep = createStep({
  id: "analyze-text",
  inputSchema: z.object({ text: z.string() }),
  handler: async ({ input }) => {
    const result = await assistant.generate({
      prompt: `Analyse the sentiment of this text: "${input.text}"`,
    });

    return { sentiment: result.text };
  },
});

const workflow = createWorkflow({
  id: "sentiment-analysis",
  inputSchema: z.object({ text: z.string() }),
  outputSchema: z.object({ sentiment: z.string() }),
})
  .then(analyzeStep)
  .commit();

Streaming

const assistant = new Agent({
  name: "stream-assistant",
  instructions: "You are a creative assistant.",
  model: scaleway("llama-3.3-70b-instruct"),
});

const stream = await assistant.stream({
  prompt: "Tell a short story about a robot learning to cook.",
  temperature: 0.7,
});

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

Model selection tips

  • Code generation: qwen3-coder-30b-a3b-instruct, devstral-small-2505.
  • General-purpose tasks: gpt-oss-120b, llama-3.3-70b-instruct.
  • Lightweight workloads: llama-3.1-8b-instruct, mistral-nemo-instruct-2407.
  • Reasoning-heavy tasks: deepseek-r1-distill-llama-70b, qwen3-235b-a22b-instruct-2507.
  • Multimodal scenarios: pixtral-12b-2409.

Best practices

  1. Security – store API keys in a secret manager, never commit them.
  2. Error handling – wrap calls in try/catch and log failures.
  3. Cost control – set maxOutputTokens and monitor usage.
  4. Temperature – pick the right creativity level (0.0-0.3 precise, 0.4-0.7 balanced, 0.8+ creative).

Resources