Janik von Rotz


2 min read

Setup opencode with Infomaniak AI Tools

No Aprils fool here. Instead you get the instructions to run opencode with Infomaniak AI Tools.

Setup Infomaniak

If not already done, create an API token here: https://manager.infomaniak.com/v3/298019/ng/profile/user/token/list

Select “ai-tools” for scope. Then open a shell and export the API token:

export API_TOKEN="******"

Now we can get info on the AI service with this curl request:

curl -G \
 -H "Authorization: Bearer $API_TOKEN" \
 -H "Content-Type: application/json" \
'https://api.infomaniak.com/1/ai'

The result will look something like this:

{"result":"success","data":[{"product_name":"Ai-Tools","product_id":103281,"account_name":"Janik von Rotz (Org)","status":"ok"}]}

For the next step you need the product_id. This id is tethered to your account.

export PRODUCT_ID="103281"

Now we can list the LLM models:

curl -G \
 -H "Authorization: Bearer $API_TOKEN" \
 -H "Content-Type: application/json" \
"https://api.infomaniak.com/2/ai/${PRODUCT_ID}/openai/v1/models" | jq

Now we have all the info to connect opencode with the Infomaniak OpenAPI.

Setup opencode

If not already done, install opencode:

pnpm install -g opencode-ai

Then we setup a custom config for opencode:

mkdir ~/.config/opencode
vi ~/.config/opencode/opencode.json

Copy the following config file and replace $PRODUCT_ID and $API_TOKEN with your values:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "infomaniak": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Infomaniak AI",
      "options": {
        "baseURL": "https://api.infomaniak.com/2/ai/${PRODUCT_ID}/openai/v1",
        "apiKey": "$API_TOKEN"
      },
      "models": {
        "llama3": {
          "name": "Llama 3 (Infomaniak)"
        },
        "mistral3": {
          "name": "Mistral 3 (Infomaniak)"
        },
        "qwen3": {
          "name": "Qwen 3 (Infomaniak)"
        },
        "gemma3n": {
          "name": "Gemma 3n (Infomaniak)"
        }
      }
    }
  },
  "model": "infomaniak/qwen3"
}

Make sure the model keys are matching the previous list.

Now start opencode and you should be able to code with Qwen 3 (Infomaniak).

Categories: Software development
Tags: llm , infomaniak , opencode , setup
Edit this page
Show statistic for this page