> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cynative.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure OpenAI Models as Cynative's LLM Provider

> Set up Cynative with OpenAI's GPT and o-series models. Configure API key, model selection, custom base URL for proxies, and advanced network options.

Cynative supports OpenAI's chat models through the Bifrost `openai` provider. This covers the standard OpenAI API as well as any OpenAI-compatible proxy or self-hosted endpoint (LiteLLM, a custom gateway, etc.) that speaks the Chat Completions API. Set three environment variables and you're running.

## Quick start

```bash theme={null}
export OPENAI_API_KEY=sk-...
export CYNATIVE_LLM_PROVIDER=openai
export CYNATIVE_LLM_MODEL=gpt-5
cynative -p "list IAM users in my AWS account that have console access"
```

No `~/.cynative/config.yaml` file is required.

## YAML configuration

Use YAML when you need fields the environment-variable surface doesn't cover, such as `extra_headers`, `openai_config`, or `keys[]` for multi-key load balancing.

```yaml theme={null}
llm:
  provider: openai
  model: gpt-5
  api_key: env.OPENAI_API_KEY       # optional — falls back to OPENAI_API_KEY env var
  network_config:
    base_url: https://api.openai.com  # optional; override for proxies or custom endpoints
    default_request_timeout_in_seconds: 60
    max_retries: 3
  openai_config:
    disable_store: true              # opt out of OpenAI's persistent conversation storage
```

### `openai_config` fields

`openai_config` mirrors Bifrost's `schemas.OpenAIConfig` directly. The most commonly used field:

| Field | Type | Description |
| - | - | - |
| `disable_store` | boolean | Opts out of OpenAI's persistent conversation storage by sending `store=false` on every request. |

For the complete set of `openai_config` fields, see Bifrost's [`schemas.OpenAIConfig`](https://github.com/maximhq/bifrost/blob/main/core/schemas/provider.go).

## Authentication

Cynative resolves the API key in this order:

1. `llm.api_key` in YAML (or the `CYNATIVE_LLM_API_KEY` env var) — recommended for the simple case.
2. `llm.keys[]` in YAML — for explicit Bifrost-shaped key configuration (multi-key load balancing, model filters, per-key weights, etc.).
3. `OPENAI_API_KEY` — the canonical fallback, used when neither `llm.api_key` nor `llm.keys[]` is set.

Setting both `llm.api_key` and `llm.keys[]` is rejected at startup with a clear error — pick one form.

Get an API key from [platform.openai.com/api-keys](https://platform.openai.com/api-keys).

## Environment variable reference

| Environment variable | YAML equivalent | Description |
| - | - | - |
| `OPENAI_API_KEY` | `llm.api_key` | OpenAI API key. |
| `CYNATIVE_LLM_PROVIDER` | `llm.provider` | Must be `openai`. |
| `CYNATIVE_LLM_MODEL` | `llm.model` | Model id (e.g. `gpt-5`, `gpt-4o`). |
| `CYNATIVE_LLM_API_KEY` | `llm.api_key` | Generic key override (takes priority over `OPENAI_API_KEY`). |
| `CYNATIVE_LLM_NETWORK_CONFIG_BASE_URL` | `llm.network_config.base_url` | API endpoint override (see proxy section below). |
| `CYNATIVE_LLM_NETWORK_CONFIG_DEFAULT_REQUEST_TIMEOUT_IN_SECONDS` | `llm.network_config.default_request_timeout_in_seconds` | Per-request timeout in seconds. Cynative default: `300`. |
| `CYNATIVE_LLM_NETWORK_CONFIG_MAX_RETRIES` | `llm.network_config.max_retries` | Retry attempts on 429/5xx errors. Cynative default: `3`. |
| `CYNATIVE_LLM_OPENAI_CONFIG_DISABLE_STORE` | `llm.openai_config.disable_store` | Set `true` to send `store=false` on every request. |
| `CYNATIVE_LLM_REASONING_EFFORT` | `llm.reasoning_effort` | Reasoning effort level for o-series models: `none`, `minimal`, `low`, `medium`, `high`. |
| `CYNATIVE_LLM_REASONING_MAX_TOKENS` | `llm.reasoning_max_tokens` | Explicit reasoning token budget (converted to an estimated effort level for OpenAI). |

## o-series reasoning models

Cynative's `reasoning_effort` and `reasoning_max_tokens` fields work with OpenAI's o-series models (`o1`, `o3`, `o4-mini`, etc.). Set `reasoning_effort` to the desired level; Cynative maps it to OpenAI's native effort knob:

```yaml theme={null}
llm:
  provider: openai
  model: o3
  api_key: env.OPENAI_API_KEY
  reasoning_effort: high
```

`reasoning_max_tokens` is converted to an estimated effort level for OpenAI-style providers (it is not forwarded as a raw token count).

## OpenAI-compatible endpoints and proxies

Many proxies and gateways speak the OpenAI Chat Completions API: LiteLLM, OpenRouter, vLLM with `--api-key`, custom gateways, etc. Point Cynative at them by overriding `network_config.base_url`:

```yaml theme={null}
llm:
  provider: openai
  model: my-deployment-name
  api_key: env.MY_PROXY_KEY
  network_config:
    base_url: https://my-proxy.example.com
```

<Warning>
  Leave the `/v1` path segment off the base URL. The Bifrost provider appends `/v1/chat/completions` automatically, so a base URL that already ends in `/v1` produces a double-path request (`/v1/v1/chat/completions`) and returns a 404.
</Warning>

## Server-side caching

OpenAI applies automatic prompt caching server-side for eligible models. Cynative does not need to configure anything — caching happens transparently and is reflected in your OpenAI usage dashboard.

## Links

* [OpenAI API reference](https://platform.openai.com/docs/api-reference)
* [Bifrost OpenAI provider source](https://github.com/maximhq/bifrost/tree/main/core/providers/openai)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.