vscode-ai-toolkit icon indicating copy to clipboard operation
vscode-ai-toolkit copied to clipboard

No header support for Ollama? (401 - Unauthorized)

Open solidprinciples opened this issue 2 months ago • 3 comments

I use an external ollama API (ollama cloud), which requires an authorization bearer token to be sent. I've seen examples for custom endpoints using headers (and have tried to get it working via their OpenAI compatible endpoint - no dice).

I am looking for a way to add in headers for the Ollama models, such that I can send the authorization header correctly.

Current my-models.yml

version: v0.1
providers:
  - name: Ollama
    models:
      - name: deepseek-v3.1:671b
        ollama_host: https://ollama.com/
      - name: glm-4.6
        ollama_host: https://ollama.com/
      - name: gpt-oss:120b
        ollama_host: https://ollama.com/
      - name: gpt-oss:20b
        ollama_host: https://ollama.com/
      - name: kimi-k2:1t
        ollama_host: https://ollama.com/
      - name: qwen3-coder:480b
        ollama_host: https://ollama.com/
      - name: qwen3-vl:235b
        ollama_host: https://ollama.com/

solidprinciples avatar Oct 25 '25 22:10 solidprinciples

Thank you for contacting us! Any issue or feedback from you is quite important to us. We will do our best to fully respond to your issue as soon as possible. Sometimes additional investigations may be needed, we will usually get back to you within 2 days by adding comments to this issue. Please stay tuned.

Hi if you need to define custom authorization headers, you can edit the yaml to add a custom model like this in $HOME/.aitk/models/my-models.yml.

version: v0.1
providers:
  - name: Custom
    models:
      - name: test-model
        chat_completion_url: https://localhost:11434/v1/chat/completions
        headers:
          Authorization: Bearer ****************
        api_model_name: test-model

a1exwang avatar Nov 04 '25 05:11 a1exwang

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.