How to use apiKey with local models endpoint?
I am trying to use opencode with my local models, but my API requires an API KEY. Here is the configuration I tried:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"lmstudio": {
"npm": "@ai-sdk/openai-compatible",
"name": "LMStudio",
"options": {
"baseURL": "https://my.domain.com/v1",
"apiKey": "xxx-xxx-xxx-xxx-xxx"
},
"models": {
"qwen3-32b": {
"name": "Qwen3 32B"
}
}
}
}
}
But I get:
UnknownError
AI_APICallError: Forbidden
Is this currently supported?
Thank you!
The above config is actually working, I had the config file in the wrong place, sorry.
@antonpetrovmain Can you also provide the correct location where the config file should be.
https://opencode.ai/docs/config/
same error. Opencode TUI totally ignores config and try to use Llama Llama-4-Scout-17B-16E-Instruct-FP8
my config: { "$schema": "https://opencode.ai/config.json", "provider": { "ollama": { "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "http://localhost:11434/v1" }, "models": { "llama3.1": {} } } } }