Sign in or sign up before continuing. Don't have an account yet? Register now to get started.
Support remote API authentication via FAURE_API_KEY (Bearer token)
## Context
The current `call_model` implementation sends requests to an OpenAI-compatible backend without authentication — no `Authorization` header is set. This works for local backends (MLX, Ollama) but blocks usage of hosted APIs (OpenAI, Mistral, Groq, Anthropic-compatible endpoints) which require a Bearer token.
## Work to do
### `lib/faure/config.rb`
Add an optional variable:
```ruby
OPENAI_API_KEY = ENV.fetch('FAURE_API_KEY', nil)
```
### `lib/faure/codeur.rb` — `call_model` method
Add the `Authorization` header when the key is present:
```ruby
req['Authorization'] = "Bearer #{Config::OPENAI_API_KEY}" if Config::OPENAI_API_KEY
```
### `ci/faure.yml` and documentation
Document `FAURE_API_KEY` as an optional variable:
| Variable | Required | Default | Description |
|---|---|---|---|
| `FAURE_API_KEY` | No | — | Bearer token for the OpenAI-compatible API. Leave empty for unauthenticated local backends. |
## Expected result
- Local backends (MLX, Ollama) continue to work without any changes
- Hosted APIs (OpenAI, Mistral, Groq, etc.) work by setting `FAURE_API_KEY`
- Single code path — no duplication
issue