Thanks for providing this - indeed I was not able to find that during my search.
I cannot get an API key as I don’t have access to Copilot myself.
I reviewed the documentation and come to the conclusion that you will not be able to access it with the OpenAI Auth etc. nodes that are part of the KNIME Gen AI Extension.
The reason is that the OpenAI API expects the API key as Bearer token in the header, the Copilot API expects and X-API-KEY. As the KNIME nodes can be used with OpenAI API compatible APIs, they expect a Bearer token.
Here are the details taken from the examples:
OpenAI API:
curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Say this is a test!"}],
"temperature": 0.7
}'
Copilot:
curl \
-X POST \
-H "Content-Type: application/json" \
-H "X-API-KEY: <Replace this with your API Key>" \
--data '<Replace this with a json request body as needed>' \
https://api.copilot.com/v1/<Replace this with a resource>`
It boils down to this line:
-H "Authorization: Bearer $OPENAI_API_KEY"
vs this line:
-H "X-API-KEY: <Replace this with your API Key>"
So this does not mean that you cannot use KNIME to interact with this API in general.
There are other alternatives you can explore - e.g.:
- use Python Script nodes - by default the bundled KNIME python environment contains the requests library so you can use websites like https://curlconverter.com/ to convert the -cURL commands above to python
- use POST Request nodes
One other observation:
Other than the introduction there are all the available Endpoints that you can use documented. I could not find anything that looks like it is used for inference… e.g. /completions or /chat/completions…