Providers

One native HTTP backend, two wire formats.

How a provider is chosen

Leading --provider (alias --backend) wins. Otherwise tny uses, in order:

  1. the provider last used, recorded in ~/.tny/settings.json
  2. openai if OPENAI_BASE_URL or OPENAI_API_KEY is set
  3. codex if a ChatGPT credential exists (CHATGPT_ACCESS_TOKEN, ~/.tny/codex-auth.json, or ~/.codex/auth.json)
  4. openai, whose connect error explains how to configure a key

Credentials and gateways

BYOK uses environment keys only. Configure base_url and api_key_env in a named profile, or export NAME_BASE_URL and NAME_API_KEY. Set AIProxy's URL explicitly. Inline or stored api_key settings fail with a migration diagnostic. SDK injection and this browser tab's ephemeral environment remain supported.

Removed protocol selectors, commands, and agent flags fail clearly. Claude models remain available through configured compatible gateways; no vendor auth artifacts or executables are discovered.

openai

Native loop. tny owns tools, MCP, skills, permissions, and sessions.

$export OPENAI_API_KEY=…
$export OPENAI_BASE_URL=https://openrouter.ai/api/v1 # optional
$tny --provider openai --model anthropic/claude-sonnet-4.6

The default wire is the Responses API (POST /v1/responses, typed SSE) — what current OpenAI models require for function tools + reasoning effort. Providers that only speak legacy Chat Completions still work: set wire_api: "chat" in the provider profile, OPENAI_WIRE_API=chat, or pass --wire-api chat. OpenAI, OpenRouter, Groq, Together, DeepSeek, ollama, llama.cpp, vLLM, and Azure (custom auth header) all fit one of the two wires.

codex

Your ChatGPT subscription on tny's native loop against the Responses-compatible chatgpt.com/backend-api/codex. Sign in with tny --provider codex login (browser, or --device on headless machines) — no Codex CLI — or hand tny a token with CHATGPT_ACCESS_TOKEN / --chatgpt-token when there is no filesystem to keep one. An existing codex login is picked up too. Tokens refresh automatically.

$tny --provider codex login
$tny --provider codex login --device
$CHATGPT_ACCESS_TOKEN=… tny --provider codex ask 'run the tests'

Grok

XAI_API_KEY selects the public xAI Responses API. tny --provider grok login uses native subscription login and refresh with the compatible chat proxy. Neither requires a vendor executable.