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

# Use LithosAI with Codex

> Connect Codex to LithosAI through a LiteLLM Responses API compatibility proxy.

## Before you begin

Create a key on the [API Keys](https://console.lithosai.cloud/keys) page, confirm the model ID
on the [Models](https://console.lithosai.cloud/models) page, and export the key in the shell where you start Codex or its local proxy.

```bash theme={null}
export LITHOSAI_API_KEY="your-key"
```

Codex no longer speaks Chat Completions. `wire_api = "chat"` is rejected at startup, and
`responses` is the only accepted value, so Codex reaches LithosAI through a proxy that
accepts Responses API requests.

<Warning>
  This is a compatibility path, not native Responses API support. LiteLLM translates common
  text and function-tool requests, but Responses-only tools and metadata may not map to Chat
  Completions. If your workflow depends on a specific Codex tool, verify it before relying on
  this setup.
</Warning>

<Steps>
  <Step title="Install LiteLLM">
    [LiteLLM](https://docs.litellm.ai) bridges the Responses API to Chat Completions.

    ```bash theme={null}
    pip install 'litellm[proxy]'
    ```

    <Warning>
      Install a current release. LiteLLM 1.82.7 and 1.82.8 were briefly replaced on PyPI in
      March 2026 by a [credential stealer](https://docs.litellm.ai/blog/security-update-march-2026).
    </Warning>
  </Step>

  <Step title="Configure the proxy">
    Give the model the `openai/` prefix and set `use_chat_completions_api`, which bridges
    incoming `/v1/responses` requests to LithosAI's `/v1/chat/completions`.

    ```yaml codex.litellm.yaml theme={null}
    model_list:
      - model_name: kimi-k3
        litellm_params:
          model: openai/moonshotai/Kimi-K3
          api_base: https://api.lithosai.cloud/v1
          api_key: os.environ/LITHOSAI_API_KEY
          use_chat_completions_api: true
          additional_drop_params: ["reasoning_effort"]

    litellm_settings:
      drop_params: true

    general_settings:
      master_key: sk-codex-proxy
    ```

    `drop_params` discards parameters a model does not accept rather than failing the
    request. `additional_drop_params` removes `reasoning_effort`: Codex asks for a reasoning
    summary, LiteLLM forwards that request in this field in a form LithosAI rejects, and
    Codex works without it. `master_key` is the token Codex sends to the proxy, not your
    LithosAI key.
  </Step>

  <Step title="Start the proxy">
    ```bash theme={null}
    litellm --config codex.litellm.yaml --host 127.0.0.1 --port 4000
    ```

    Leave it running, and confirm it is up. The proxy holds your LithosAI key, so keep it
    bound to `127.0.0.1` and do not expose it to a network.

    ```bash theme={null}
    curl http://127.0.0.1:4000/health/liveliness
    ```
  </Step>

  <Step title="Point Codex at it">
    ```toml ~/.codex/config.toml theme={null}
    model = "kimi-k3"
    model_provider = "lithosai"

    [model_providers.lithosai]
    name = "LithosAI"
    base_url = "http://127.0.0.1:4000/v1"
    env_key = "LITELLM_API_KEY"
    wire_api = "responses"
    requires_openai_auth = false
    ```

    `env_key` names the variable holding the proxy's `master_key`, so export that too.

    ```bash theme={null}
    export LITELLM_API_KEY="sk-codex-proxy"
    codex
    ```
  </Step>
</Steps>

## Troubleshooting

| Symptom                                                                          | Cause                                                                                                             |
| -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `wire_api = "chat"` is no longer supported                                       | `base_url` points at LithosAI directly. Point it at the proxy.                                                    |
| `404` on `/v1/responses`                                                         | The model entry uses `hosted_vllm/`. Codex needs `openai/` with `use_chat_completions_api`.                       |
| `400` with `No connected db.`                                                    | `LITELLM_API_KEY` does not match the proxy's `master_key`. LiteLLM reports the lookup failure, not an auth error. |
| `400` mentioning `reasoning_effort` and `Input should be 'none', 'minimal', ...` | The proxy configuration is missing `additional_drop_params: ["reasoning_effort"]`.                                |

Issues common to every agent are listed under [Common issues](/coding-agents#common-issues).
