JetBrains / JetBrains/thinkrail

Add a custom AI endpoint (models.json provider) form to Providers settings

Open
#436 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
467
Forks
37
Avg merge
1d 52m
Merged PRs (30d)
143

Description

## Problem

ThinkRail's Providers settings only let you sign in to providers pi already ships. There is no way from the app to point pi at a self-hosted or third-party endpoint or at an aggregator that speaks a standard API.

pi already supports this via `~/.pi/agent/models.json`: a provider entry with `baseUrl`, `api`, optional `apiKey`, optional `headers`, and a model list. The gap is purely the write path and UI.

## Proposed solution

Add an "Add custom endpoint" action under Providers settings that opens a form:

- Provider id (slug, e.g. `ollama`, `my-gateway`)
- Display name (optional)
- Base URL
- API standard, one of pi's four: `openai-completions`, `openai-responses`, `anthropic-messages`, `google-generative-ai`
- API key (masked; optional, since local servers ignore it and pi accepts a placeholder)
- Models: one or more model ids, each optionally with a display name and reasoning / context-window fields
- Advanced (collapsed): custom headers, `compat.supportsDeveloperRole`, `compat.supportsReasoningEffort`

Submitting writes the provider entry into `models.json` through pi's runtime, refreshes availability, and the new provider appears as a Connected card. The card should offer Edit and Remove for entries the app created. Entries the user hand-wrote stay "Managed" as today.

Acceptance:

- A user with a local Ollama can add it from Settings without touching the filesystem and select one of its models in a chat tab.
- The e2e suite covers add, edit, and remove against the isolated lane's `PI_CODING_AGENT_DIR`.
- `provider.status` reflects the new provider without a host restart.

## Alternatives considered

- Keep hand-editing `models.json` and document it. Works, but defeats the potential point of a desktop/mobile client, and the file is unreachable from a phone.
- Model discovery by probing the endpoint (`/v1/models`) instead of a manual model list. Nice follow-up, not needed for v1.

## Additional context

pi reference: https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/models.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Contributor guide

Open the contributing guide

Research direction

Start at the Providers settings entry point and the pi runtime write path for ~/.pi/agent/models.json. Trace how provider.status and availability refresh today, then run the e2e suite against the isolated lane's PI_CODING_AGENT_DIR. Done means add, edit, and remove work without a host restart and a configured model can be selected in a chat tab.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ai, desktop, mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.