> For the complete documentation index, see [llms.txt](https://docs.otari.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.otari.ai/otari/for-integrators/chatgpt-subscription.md).

# Use with a ChatGPT subscription

A ChatGPT subscription is separate from the OpenAI Platform API and does not provide a standard API key. Otari can reach subscription-backed models only through a third-party Codex OAuth proxy that exposes an OpenAI-compatible API.

```
application -> Otari -> local OAuth proxy -> ChatGPT subscription
```

This is an unofficial integration. OpenAI may change the backend, subscription limits still apply, and a third-party proxy may create account or terms-of-service risk. Use an OpenAI Platform API key for production workloads.

## Prerequisites

* A local Otari deployment
* A ChatGPT Plus or Pro subscription
* A Codex OAuth proxy that serves an OpenAI-compatible API, such as [CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI)

Run the proxy on a private address and follow its authentication instructions. It holds your subscription session and should not be exposed publicly.

## Verify the proxy

Ask the proxy for its model catalog, including its downstream key if configured:

```bash
curl http://localhost:8317/v1/models \
  -H "Authorization: Bearer $CHATGPT_PROXY_KEY"
```

If it does not implement `/v1/models`, verify with a chat completion and declare its model IDs explicitly in Otari.

## Register it in Otari

Create a named OpenAI-compatible provider instance:

```yaml
providers:
  chatgpt:
    provider_type: openai-compatible
    api_base: "http://localhost:8317/v1"
    api_key: ${CHATGPT_PROXY_KEY}
    models:
      - gpt-5
```

Remove `api_key` when the proxy is intentionally keyless. The `models` list is needed only when the proxy has no working model-listing endpoint.

Models use the instance name, for example `chatgpt:gpt-5`. See [Named provider instances](/otari/for-operators/models.md#named-provider-instances).

## Pricing

A subscription has no per-token invoice. You can either:

* Leave the model unpriced and set `require_pricing: false`.
* Configure a counterfactual API price for analytics.

```yaml
pricing:
  chatgpt:gpt-5:
    input_price_per_million: 1.25
    output_price_per_million: 10.00
```

Configured pricing also drives budget enforcement. A counterfactual price can therefore exhaust a real Otari budget even though the subscription charged no per-request fee.

## Route a request

```python
from otari import OtariClient

client = OtariClient(api_base="http://localhost:8000", api_key="tk-...")
response = client.completion(
    model="chatgpt:gpt-5",
    messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(response.choices[0].message.content)
```

Provider routing, API-key access, usage logging, and configured budgets work as they do for any other named instance.

## Caveats

* The proxy may break when its upstream backend changes.
* Subscription usage caps remain in force.
* Keep the proxy and its OAuth session private.
* Model IDs and capabilities come from the proxy, not from Otari.
* API pricing attached to the instance is an estimate, not the subscription's actual charge.

For the supported API-key path, use the [OpenAI provider guide](/otari/for-operators/openai.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.otari.ai/otari/for-integrators/chatgpt-subscription.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
