Relay365Multi-model API relay desk
← All desk bulletins
Field notes from the deskEN1 desk reads

Shift Note: Environment Variables Set in Ten Minutes

A terminal session can have the right API key while an editor has none. That is usually a process-inheritance issue, not a broken credential. This ten-minute shift note gets environment variables into the right session, makes them persistent where appropriate, and checks the result without printing secrets.

First minute: identify the terminal receiving the variables

Environment variables are named strings available to a process and usually inherited by its child processes. Setting one in a terminal affects programs launched from that terminal afterward. It does not update an already-running editor, server, or neighboring terminal.

On macOS, the default interactive shell is usually zsh. Linux commonly uses bash, but check your actual shell rather than assuming. Run printenv SHELL for a clue about your configured login shell; it does not necessarily identify the shell currently running. On Windows, the examples below use PowerShell, not Command Prompt.

Minutes two through four: set macOS and Linux session values

In bash or zsh, run export OPENAI_API_KEY='replace-with-your-key' and then export OPENAI_BASE_URL='https://api.api365relay.com/v1'. Run these as two separate commands. There must be no spaces around the equals sign.

These names suit OpenAI SDK workflows. The official OpenAI Python SDK can read both variables automatically; other clients may require explicit configuration. Environment-variable names are application conventions, not universal settings that every AI tool recognizes.

Quotes keep spaces and shell-special characters together. The commands above use placeholders deliberately. Replacing a placeholder with a real credential can leave that credential in shell history. For routine use, prefer a secret manager or a protected local configuration mechanism supported by your application.

Start your program from this same terminal. If it now recognizes the settings, the session-level configuration is working.

Minutes four through six: set Windows PowerShell values

In PowerShell, run $env:OPENAI_API_KEY = 'replace-with-your-key' and then $env:OPENAI_BASE_URL = 'https://api.api365relay.com/v1'. These assignments affect the current PowerShell process and programs it launches afterward.

For persistent, per-user values, run [Environment]::SetEnvironmentVariable('OPENAI_API_KEY', 'replace-with-your-key', 'User') and [Environment]::SetEnvironmentVariable('OPENAI_BASE_URL', 'https://api.api365relay.com/v1', 'User'). Administrator access is normally unnecessary for user-scoped variables.

Persistent changes do not rewrite the current process environment. Keep the session assignments if you need to work immediately. For subsequent work, restart the terminal application and any editor that launches your tools. A new tab inside an old terminal process can still inherit stale values.

Minutes six through eight: make Unix shell settings persistent

For interactive zsh sessions, add the two export commands to ~/.zshrc. For interactive, non-login bash sessions, use ~/.bashrc. Bash login shells read a login startup file such as ~/.bash_profile instead; check whether yours already loads ~/.bashrc before duplicating settings.

Open a fresh terminal to test startup behavior. Alternatively, source ~/.zshrc or source ~/.bashrc applies that file to the current matching shell. Neither approach updates applications already running elsewhere.

Shell startup files and Windows user environment values are not secret vaults. Avoid committing credentials, including startup files containing credentials, to a repository. A .env file is another option only when your application explicitly loads it; the operating system does not automatically import it.

Final two minutes: verify presence without exposing credentials

  • On macOS or Linux, run printenv OPENAI_BASE_URL to inspect the non-secret endpoint.
  • In bash or zsh, run if [ -n "$OPENAI_API_KEY" ]; then printf 'Key is set\n'; else printf 'Key is missing\n'; fi to check for a nonempty key.
  • In PowerShell, run $env:OPENAI_BASE_URL and then [bool]$env:OPENAI_API_KEY to inspect the endpoint and check key presence.
  • If a tool still reports missing credentials, confirm its documented variable names and restart it from the configured terminal.

Handoff: point the intended client at Relay365

Relay365 fits workflows needing a pay-as-you-go relay desk across multiple model families. It works with Claude Code, Codex, Gemini CLI, and OpenAI SDKs, although each tool has its own configuration requirements. Its API base is https://api.api365relay.com; OpenAI clients use https://api.api365relay.com/v1.

Create a Relay365 account when you are ready to connect a client, obtain your key, and select an available model using the service’s documented model identifier. Keep the key out of screenshots and logs, and remove temporary credentials after testing.

Further desk bulletins

Curious how it runs on your own code? Sign up →