Skip to main content

OpenAI

The gateway speaks the OpenAI API upstream and holds the OpenAI key.

What's specific to OpenAI

PropertyValue
Provider idopenai
Gateway speaksOpenAI REST → api.openai.com/v1
CredentialAPI key (Bearer), server-held
SigningNone
Client base URLOPENAI_BASE_URLhttp://<gateway>:8787/v1

Everything shared — self-hosting, the config-based redirect, how credentials are stored — is documented once in the gateway.

Configure the provider

Console → Providers → add openai and paste the API key. Or seed it from the environment with ANYRAY_PROVIDER_KEY_OPENAI.

Optional per-request fields (org, project, beta) ride the x-anyray-openai-organization, x-anyray-openai-project, and x-anyray-openai-beta headers.

Route requests to it

Point the SDK at the gateway and send the provider header (omit it when OpenAI is your only configured provider):

export OPENAI_BASE_URL=http://<gateway>:8787/v1
# requests carry: x-anyray-provider: openai

Models use OpenAI ids, e.g. gpt-4o, gpt-4o-mini, o1-mini.