Can I Use Custom API for Cody in VSCode?

Hello,

I am using Cody as a VSCode extension and would like to know if it is possible to use Azure OpenAI as a custom API provider. If so, could you provide guidance on how to configure it properly?

Thank you!

Hey @OMS90

You can configure Cody for VS Code to provide your own API key for OpenAI compatible models like this: Experimental Models.

If openai as provider does not work then replace the provider key value with groq.

I hope that helps.

Thanks for the reply. I am not familiar with these settings, so let me check a little more. In particular, I am not sure of the value to set for the endpoints section. (I know the value of
I do know the value “path”.)
I’m not sure if I should add the following to the “setting.json” file?

{
  "cody.dev.models": [
    {
      "provider": "openai",
      "model": "gpt-XX",
      "inputTokens": 32000,
      "outputTokens": 4000,
      "apiKey": "XXXXXXXXXXXXX",
      "options": {
          "temperature": 0.0
      },
      "apiEndpoint": "https://XXXXXXXXXXXXX.openai.azure.com"
    },
  ]
}

Hey @OMS90

For using the correct API endpoint you can read more here in the Azure OpenAI Rest API on how to set your parameters correctly.

In your case, you need to modify the apiEndpoint key.

I tried to set it up, but got the error shown below.

Bad Request: status 400, reason model "openai/gpt-XX" is not available on sourcegraph.com

I have set the value of Azure’s deployment-id as the model value.
The model actually used in this ID is “gpt-4o”.
Is this wrong?

Thanks for your kind support.

Then try to use as provider ‘groq’ instead of ‘OpenAI’ which is also OpenAI compatible.