Integrating gpt models from other companies besides OpenAI

Hello, KNIME Support Team.

I want to integrate Copilot, a gpt model developed by MS, is there any way to import Copilot model in KNIME?

I know that gpt models developed by OpenAI can get OpenAI API, authenticate token with “OpenAI Authenticator” node, and import gpt models with “OpenAI LLM Connector” node.

I got the same API for MS’s Copilot, but I don’t know which node to combine with for authentication. When I proceed to the “OpenAI Authenticator” node, it keeps failing as invalid key, so I’m asking a question.

Your answer would be appreciated.

You can use the OpenAI Authenticator node to connect to other providers that have an OpenAI API compatible API.

You need to open the advanced settings of the node and to provide the base URL of your API provider (equivalent to https://api.openai.com/v1).

image

In your Chat Model / LLM Connector you then need to pass in the model name as a String Variable (e.g. via String Widget or String Configuration Node), select “All Models” and then select the flow variable containing the model name.

1 Like

Thanks for your answer.

I know that COPILOT is based on OPENAI’s GPT4, so do I need to get an API KEY from OPENAI to use it? Or should I use MS’s COPILOT’s API to get it?

Currently, I received the API of OPENAI and saw the list of all models, but COPILOT does not exist, and when I enter the API of COPILOT into the node you told me and run it, it does not run because it is an invalid key.

Help would be appreciated.

Well if the model you want to use is provided by MS, then I take you will have to use the MS Copilot API. If it is not an OpenAI Model then the OpenAI API Endpoint and your API Key won’t help…

You need the MS Copilot API endpoint and an API Key for that (if that exists).

I did a brief google search on this topic, but was not able to find any documentation that suggests there is a corresponding MS Copilot API.

If you can confirm that this exists and can provide some documentation then I’m happy to take a look…

Thank you for your response.

I followed this article

and got the API key for MS’s Copilot.

You said that you didn’t find any documentation that suggests that there is an MS Copilot API, but the key I was issued is incorrect, so it might not be authorized in KNIME.

If possible, could you get the key and set up an endpoint to test the connection?

I’d like to know if it’s just me or if it’s a common problem.

Thank you.

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…

2 Likes

Your answer will help me a lot.

It’s hard to integrate with OpenAI related nodes, and you mentioned using Python Script as an alternative, so I’ll try it.

Thank you very much @MartinDDDD !!!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.