๐Ÿ“ฑ Using Claude API

Last updated on Oct 28, 2026

To use Claude, you need to go through its API.

An API (Application Programming Interface) is a set of functionalities made available to a client/user via a library (methods of a programming language) or a web service.

Setting up the API

To make a request, you need an API key. It will identify who is doing what (in this case, who is using Claude). To generate a key, you can go to this site, in the corresponding tab.

Setting up Voltask

Once the API key has been obtained, you need to set up the HTTP Request block in Voltask to send a request:

  • the method is POST
  • the URL is https://api.anthropic.com/v1/messages
  • the body looks like this: {"model": "claude-opus-4-20250514","max_tokens": 1024,"messages": [{"role": "user", "content": "{{prompt"}}]} With {{prompt}} being the query sent to Claude.
  • the header looks like this: {"x-api-key":"{{APIkey}}","anthropic-version":"2023-06-01","content-type":"application/json"} With {{APIkey}} being the API key obtained earlier.

Setting up Celestory

To retrieve Claude's response, the API sends a JSON object.

JSON (JavaScript Object Notation) is a textual data format used for data transmission. A JSON object is a string (text) that contains the data to be transmitted. These objects are enclosed in braces, and associate a key with a value (text, list, number, boolean value, or another JSON object), separated by colons (for example: {"fruits": ["apple", "banana"], "number": 2, "likes": true})

In Celestory, it is possible to select only the AIโ€™s response using the Execute Javascript block. Here is the code to do that:

raw = celestoryPoints.get("answer", "");
let answer;
try {
    answer = typeof raw === "string" ? JSON.parse(raw) : raw;
    const content = answer?.content?.[0]?.text;
    if (content) {
        celestoryPoints.set("res", content);
    } else {
        console.error("Contenu introuvable dans la structure :", answer);
    }
} catch (e) {
    console.error("Erreur lors du parsing ou de lโ€™accรจs au contenu :", e, raw);
}
celestoryPoints.set("res", answer["content"][0]["text"]);

This way, it is possible to retrieve the AIโ€™s response and use it in other blocks. Note that a response from the HTTP Request block may take several tens of seconds.