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

# Using a Custom Inference Endpoint

> Redirect a hosted environment session at your own OpenAI- or Anthropic-compatible inference server

By default, environment sessions hit the inference endpoints they were built against. When you want a session to instead talk to your own inference server — for example a self-hosted vLLM cluster exposing an OpenAI-compatible API — pass `env_overrides` to `Environment.session(...)`.

```python theme={null}
from openreward import OpenReward

client = OpenReward()
env = client.environments.get("GeneralReasoning/counter")

with env.session(
    task=task,
    env_overrides={"OPENAI_BASE_URL": "https://my-vllm.example.com/v1"},
) as session:
    ...
```

The overrides are upserted onto the main container of the session pod at session-create time, before any tool calls run.

## Accepted keys

If you are the owner of the environment, you may override **any** env var on the main container — handy when developing or testing your own environment.

Other callers are restricted to the following keys; anything else returns a `400`:

| Key                  | Purpose                                     |
| -------------------- | ------------------------------------------- |
| `OPENAI_BASE_URL`    | Override the OpenAI-compatible endpoint URL |
| `OPENAI_API_KEY`     | Override the OpenAI API key                 |
| `ANTHROPIC_BASE_URL` | Override the Anthropic endpoint URL         |
| `ANTHROPIC_API_KEY`  | Override the Anthropic API key              |

<Info>
  For API keys you do not need to redirect to a custom endpoint, prefer the `secrets=` channel — it never exposes the raw value to your environment code. See [Keeping Secrets Secret](/environments/keeping-secrets-secret). Use `env_overrides` for the API key only when it is paired with a custom `*_BASE_URL` whose host the secrets egress allowlist would otherwise reject.
</Info>

## Pool isolation

Sessions created with overrides run in a separate pod pool from default sessions, keyed by a hash of the overrides map. Two callers passing the same `env_overrides` will share a pool; callers passing different overrides will not.
