NavigationContentFooter
Jump toSuggest an edit
Was this page helpful?

Integrating Scaleway Generative APIs with popular AI tools

Reviewed on 18 February 2025Published on 18 February 2025

Scaleway’s Generative APIs are designed to provide easy access to the latest AI models and techniques. Our APIs are built on top of a robust infrastructure that ensures scalability, reliability, and security. With our APIs, you can integrate AI capabilities into your applications, such as text generation, image classification, and more.

Comparison of AI tools and librariesLink to this anchor

The following table compares AI tools and libraries supported by Scaleway’s Generative APIs:

Tool/LibraryDescriptionUse casesIntegration effort
OpenAI clientPopular AI library for natural language processingText generation, language translation, text summarizationLow
LangChainLibrary for building AI applications leveraging RAGInference, embeddings, document indexing and retrievalMedium
LlamaIndexLibrary for building advanced AI RAG applicationsKnowledge graph building, document retrieval, data indexingMedium
Continue DevIDE extension for AI-powered coding assistanceCode completion, code reviewLow
Zed AIIDE including AI-powered coding assistanceCode completion, code reviewLow
Bolt.diySoftware to create applicationsCode generation, code editionLow
Chatbox AIDesktop client for generative APIs, available on Windows, Mac, LinuxAI copilot for documents, images, or codeLow
cURL/PythonDirect HTTP API calls for custom integrationsCustom applications, data processingHigh
Note

The integration effort is subjective and may vary depending on the specific use case and requirements.

OpenAI client librariesLink to this anchor

Scaleway Generative APIs follow OpenAI’s API structure, making integration straightforward. To get started, you’ll need to install the OpenAI library and set up your API key.

ConfigurationLink to this anchor

To use the OpenAI client library with Scaleway’s Generative APIs, first install the required dependencies:

pip install openai

Then set the API key and base URL in your OpenAI-compatible client:

from openai import OpenAI
client = OpenAI(
base_url="https://api.scaleway.ai/v1",
api_key="<API secret key>"
)
Tip

Make sure to replace <API secret key> with your actual API key.

Using OpenAI client for text generationLink to this anchor

To use OpenAI client for text generation, you can create a client.chat.completions object and call the create method:

response = client.chat.completions.create(
model="llama-3.1-8b-instruct",
messages=[{"role": "user", "content": "Tell me a joke about AI"}]
)
print(response.choices[0].message.content)

LangChain (RAG & LLM applications)Link to this anchor

LangChain is a popular library for building AI applications. Scaleway’s Generative APIs support LangChain for both inference and embeddings.

PythonLink to this anchor

Tip

Refer to our dedicated documentation for implementing Retrieval-Augmented Generation (RAG) with LangChain and Scaleway Generative APIs

LlamaIndex (advanced RAG applications)Link to this anchor

LlamaIndex is an open-source framework for building Large Language Models (LLMs) based applications, especially optimizing RAG (Retrieval Augmented Generation) pipelines.

  1. Install the required dependencies to use the LlamaIndex framework with Scaleway’s Generative APIs:

    pip install llama-index-llms-openai-like
  2. Create a file main.py and add the following code to it to configure the OpenAILike client and your secret key:

    from llama_index.llms.openai_like import OpenAILike
    from llama_index.core.llms import ChatMessage
    llm = OpenAILike(
    model="llama-3.1-8b-instruct",
    api_key="<API secret key>",
    api_base="https://api.scaleway.ai/v1",
    max_tokens=512,
    temperature=0.7,
    top_p=1,
    presence_penalty=0,
    )
    Tip

    Make sure to replace <API secret key> with your actual API key.

  3. You can then interact with the LLM by sending messages to the model with the following code:

    response = llm.chat([ChatMessage("Could you tell me about Scaleway please ?")])
    print(response)
  4. Finally, run main.py:

    python main.py

    The LLM response should display an answer:

    Generally, Scaleway is a reliable and secure cloud provider that offers a range of services for businesses and developers.

Javascript (Typescript)Link to this anchor

To perform chat conversations with Langchain, first install langchain and @langchain/openai packages using your node package manager.

  1. Use the following command to install Langchain using npm (yarn and pnpm are also available):

    npm install langchain @langchain/openai
  2. Edit your package.json file to ensure it has the "type": "module" property:

    {
    "type": "module",
    "dependencies": {
    "@langchain/openai": "^0.4.4",
    "langchain": "^0.3.19"
    }
    }
  3. Create a main.js file and add the following content to it:

    import { ChatOpenAI } from "@langchain/openai";
    const chat = new ChatOpenAI({
    apiKey: "<API secret key>",
    model: "llama-3.1-8b-instruct",
    configuration: {
    baseURL: "https://api.scaleway.ai/v1",
    }
    });
    const response = await chat.invoke("Tell me a joke");
    console.log(response.content);
    Tip

    Make sure to replace <API secret key> with your actual API secret key.

  4. Run main.js:

    node main.js

    The model answer should display:

    Why couldn't the bicycle stand up by itself? Because it was two-tired.

Note that other Langchain objects from OpenAI client library are also compatible, such as OpenAI and OpenAIEmbeddings.

Continue Dev (AI coding assistance)Link to this anchor

Continue Dev is a library that provides AI-powered coding assistance. Scaleway’s Generative APIs support Continue Dev for code completion and more.

Tip

Refer to our dedicated documentation for

  • Integrating Continue Dev with Visual Studio Code
  • Integrating Continue Dev with IntelliJ IDEA

Zed AI (coding assistance)Link to this anchor

Zed is an IDE (Integrated Development Environment) including AI coding assistance support. Scaleway’s Generative APIs support Zed AI code completion and more.

Tip

Refer to our dedicated documentation for connecting Zed to Generative APIs

Chatbox AILink to this anchor

Chatbox AI is a powerful AI client and smart assistant, compatible with Scaleway’s Generative APIs service. It is available across multiple platforms, including Windows, macOS, Android, iOS, Web, and Linux.

Tip

Refer to our dedicated documentation for installing and configuring Chatbox AI with Generative APIs

Bolt.diy (code generation)Link to this anchor

Bolt.diy is a software enabling users to create web applications from the prompt.

  1. Install and launch Bolt.diy locally. Follow the setup instructions provided in the Bolt.diy GitHub repository.
  2. Once Bolt.diy is running, open the interface in your web browser.
  3. Click the icon next to the Bolt logo to display the sidebar.
  4. Click the cogwheel icon in the sidebar’s bottom left corner to open the Settings.
  5. Click Local Providers to add a new external provider configuration.
  6. Toggle the switch next to OpenAILike to enable it. Then, enter the Scaleway API endpoint: https://api.scaleway.ai/v1 as the base URL.
  7. In Bolt’s main menu, select OpenAILike and input your Scaleway Secret Key as the OpenAILike API Key.
  8. Select one of the supported models from Scaleway Generative APIs. For best results with Bolt.diy, which requires a significant amount of output tokens (8000 by default), start with the llama-3.1-8b-instruct model.
  9. Enter your prompt in the Bolt.diy interface to see your application being generated.

Alternatively, you can also setup your Scaleway Secret Key by renaming .env.example to .env, adding corresponding environment variables values and restarting Bolt.diy:

OPENAI_LIKE_API_BASE_URL=https://api.scaleway.ai/v1
OPENAI_LIKE_API_KEY=###SCW_SECRET_KEY###

To enable configuration from .env is taken into account, you still need to enable OpenAILike from Bolt interface in Settings > Local Providers section.

Note

If you first configured your credentials through the browser, you also need to reset your browser’s cookies for your localhost domain (as Bolt.diy stores model provider configuration information in the browser).

Tip

If you want to limit access to a specific Scaleway Project, replace API endpoint with https://api.scaleway.ai/###PROJECT_ID###/v1/ since the default URL https://api.scaleway.ai/v1/ can only be used with the default project.

Chatbox AILink to this anchor

Chatbox AI is a powerful AI client and smart assistant, compatible with Scaleway’s Generative APIs service. It is available across multiple platforms, including Windows, macOS, Android, iOS, Web, and Linux.

Tip

Refer to our dedicated documentation for installing and configuring Chatbox AI with Generative APIs

Custom HTTP integrationsLink to this anchor

You can interact with Scaleway’s Generative APIs directly using any HTTP client.

cURL exampleLink to this anchor

To use cURL with Scaleway’s Generative APIs, you can use the following command:

curl https://api.scaleway.ai/v1/chat/completions \
-H "Authorization: Bearer <API secret key>" \
-H "Content-Type: application/json" \
-d '{
"model": "llama-3.1-8b-instruct",
"messages": [{"role": "user", "content": "What is quantum computing?"}]
}'
Tip

Make sure to replace <API secret key> with your actual API key.

Python HTTP exampleLink to this anchor

To perform HTTP requests with Scaleway’s Generative APIs, install the requests dependency:

pip install requests

Then, you can use the following code:

import requests
headers = {
"Authorization": "Bearer <API secret key>",
"Content-Type": "application/json"
}
data = {
"model": "llama-3.1-8b-instruct",
"messages": [{"role": "user", "content": "Explain black holes"}]
}
response = requests.post("https://api.scaleway.ai/v1/chat/completions", json=data, headers=headers)
print(response.json()["choices"][0]["message"]["content"])
Tip

Make sure to replace <API secret key> with your actual API key.

Was this page helpful?
API DocsScaleway consoleDedibox consoleScaleway LearningScaleway.comPricingBlogCareers
© 2023-2025 – Scaleway