Repository navigation
feat(login): choose otari.ai region or own gateway at /login otari - #83
Merged
Merged
Conversation
/login otari now asks which Otari to use (otari.ai, otari.ai EU region,
or a self-hosted/local gateway URL) before the API key, verifies the key
against {url}/models, follows otari.ai's 421 to the region that minted
the key, and stores the gateway URL with the credential. Requests,
discovery, routing and gateway tools follow the stored gateway; a stored
login wins over OTARI_API_KEY/OTARI_BASE_URL, which remain the fallback.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/login otariin Pi only asked for an API key, so there was no way to pick otari.ai's EU region or point at a local/self-hosted gateway without settingOTARI_BASE_URL.The login now:
https://eu.api.otari.ai/api/v1), or Your own gateway… (URL prompt;/api/v1added when left out; HTTP only for loopback).{url}/modelsbefore saving, so a bad key or unreachable gateway fails at login. A 421 from otari.ai naming the key's region switches to that region automatically. Only otari.ai region hosts are followed, so the key is never sent elsewhere.env.OTARI_BASE_URLon the API-key credential).Requests (through
auth.baseUrl), model discovery, subagent routing and gateway tools all follow the stored gateway.Which settings win: a saved login (key + gateway) wins over
OTARI_API_KEY/OTARI_BASE_URL. After/logout otarithose two apply again. Keys saved by older versions have no gateway recorded and keep usingOTARI_BASE_URL.Changes
src/login.ts(new): the login flow and how the saved key and gateway are read back.src/config.ts: the list of otari.ai regions; URL checks reusable by the login, and they accept the EU host.src/provider.ts: uses the new login; discovery and refresh follow the stored gateway.Not covered
omp (
omp login otari) still only asks for a key. Its login API can't store a URL next to a plain key, so it needs a different approach in a follow-up.Testing
npm test: all 254 pass. New unit tests cover region choice, a custom gateway URL, an HTTP URL that isn't localhost, following the 421 to the right region, refusing a 421 that points outside otari.ai, a rejected key, an unreachable gateway, an empty key, how the saved key and URL are read back, and discovery against the stored gateway.OTARI_BASE_URLset and checks that a restarted session still uses the saved URL.tsc --noEmitand biome are clean.🤖 Generated with Claude Code