Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/config-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ Active LLM provider to use.
| `"ollama"` | Local Ollama instance |
| `"llamacpp"` | Local llama.cpp server |
| `"openai"` | OpenAI API directly |
| `"openaicompatible"` | OpenAI-compatible API endpoint |
| `"mlx"` | MLX on Apple Silicon (local) |
| `"llmgateway"` | LLM Gateway unified API |
| `"deepseek"` | DeepSeek API |
Expand Down Expand Up @@ -213,6 +214,28 @@ OpenAI can also use your ChatGPT subscription via Autohand's built-in OpenAI sig
| `contextWindow` | number | No | Auto | Exact model context window. Set this to override stale local assumptions. |
| `chatgptAuth` | object | Yes for `chatgpt` mode | - | Stored ChatGPT/Codex auth tokens and account id |

### `openaicompatible`

OpenAI-compatible provider configuration for custom gateways/proxies that expose an OpenAI-style API.

```json
{
"openaicompatible": {
"baseUrl": "https://your-provider.example.com/v1",
"model": "gpt-4o-mini",
"apiKey": "your-provider-key"
}
}
```

| Field | Type | Required | Default | Description |
| --------- | ------ | -------- | -------------------------- | ------------------------------------------------------------------ |
| `apiKey` | string | No | - | API key for endpoints that require bearer auth |
| `baseUrl` | string | Yes | - | OpenAI-compatible endpoint base URL (for example `.../v1`) |
| `model` | string | Yes | - | Model name supported by your provider |

When `apiKey` is omitted, requests are sent without an `Authorization` header.

### `mlx`

MLX provider for Apple Silicon Macs (local inference).
Expand Down
17 changes: 17 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function normalizeProviderName(provider: unknown): ProviderName | undefined {
"ollama",
"llamacpp",
"openai",
"openaicompatible",
"mlx",
"llmgateway",
"azure",
Expand Down Expand Up @@ -649,6 +650,7 @@ function isModernConfig(
typeof (config as AutohandConfig).ollama === "object" ||
typeof (config as AutohandConfig).llamacpp === "object" ||
typeof (config as AutohandConfig).openai === "object" ||
typeof (config as AutohandConfig).openaicompatible === "object" ||
typeof (config as AutohandConfig).mlx === "object" ||
typeof (config as AutohandConfig).azure === "object" ||
typeof (config as AutohandConfig).zai === "object" ||
Expand Down Expand Up @@ -832,6 +834,7 @@ export function getProviderConfig(
ollama: config.ollama,
llamacpp: config.llamacpp,
openai: config.openai,
openaicompatible: config.openaicompatible,
mlx: config.mlx,
llmgateway: config.llmgateway,
azure: config.azure,
Expand Down Expand Up @@ -868,6 +871,20 @@ export function getProviderConfig(
return null;
}
}
} else if (chosen === "openaicompatible") {
const { apiKey, model, baseUrl } = entry as ProviderSettings;
if (!model || !baseUrl) {
return null;
}

const sanitizedApiKey =
apiKey && apiKey !== "replace-me" ? apiKey : undefined;

return {
...entry,
...(sanitizedApiKey ? { apiKey: sanitizedApiKey } : {}),
baseUrl,
};
} else if (
chosen === "openrouter" ||
chosen === "llmgateway" ||
Expand Down
1 change: 1 addition & 0 deletions src/core/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@ export class AutohandAgent {
if (this.runtime.config.ollama) providers.push('ollama');
if (this.runtime.config.llamacpp) providers.push('llamacpp');
if (this.runtime.config.openai) providers.push('openai');
if (this.runtime.config.openaicompatible) providers.push('openaicompatible');
if (this.runtime.config.mlx) providers.push('mlx');
if (this.runtime.config.llmgateway) providers.push('llmgateway');
if (this.runtime.config.zai) providers.push('zai');
Expand Down
Loading