vercel-labs / vercel-labs/ai-cli
[Proposal]: Add explicit OpenAI-compatible and Responses text providers
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 805
- Forks
- 63
- Avg merge
- 17m
- Merged PRs (30d)
- 10
Description
Summary
Add an explicit custom text-provider contract while preserving AI Gateway as the default:
--provider openai-compatiblefor Chat Completions--provider openai-responsesfor Responses streaming--base-url,--api-key-env, optional--models-url, and existing--model- equivalent
AI_CLI_*environment variables - fixed, non-secret attribution headers from
PAPERCLIP_AGENT_ID/PAPERCLIP_RUN_ID - fail closed for image, video, speech, and transcription in custom modes
- redact configured keys, bearer auth, and URL userinfo from errors
The existing package metadata declares Apache-2.0, but the repository and npm tarball omit the license text. The proposal also adds the canonical Apache-2.0 LICENSE to the repository and packed CLI.
Motivation
Self-hosted routers and local model gateways need a supported text path that cannot silently fall back to Vercel AI Gateway. API-key environment indirection keeps keys out of command history, and custom model listing should use the selected endpoint rather than contacting Gateway.
Implementation notes
A reviewed reference implementation is available in valkyriweb/ai-cli PR 1:
https://github.com/valkyriweb/ai-cli/pull/1
Exact reviewed head: 7803a8f7a53fa37d113adb0b469c76c988166165
The provider selection is centralized in src/lib/provider.ts; model discovery dispatches by provider; Responses mode uses streaming because some compatible routers require stream: true. Gateway code paths and defaults are unchanged.
The bundled ai-cli skill is extended rather than adding a competing skill, with a focused Agent Skill authoring reference.
Testing notes
- deterministic fetch tests assert exact
/models,/chat/completions, and/responsesURLs - assert allowlisted headers and no
ai-gateway.vercel.shrequest in custom modes - unsupported modality and redaction tests
- full typecheck, format, lint, tests, and build
- real synthetic Responses smoke through a self-hosted router using a cheap text model
- independent exact-head review and TruffleHog scan are clean
Risks or tradeoffs
Custom modes intentionally support text only. OpenAI-compatible model metadata is less rich than Gateway metadata, so pricing/provider endpoint details are unavailable. Responses mode streams internally and collects the final text to preserve current CLI output semantics.
Co-contributor credit
Yes, credit @valkyriweb.
Checklist
- I searched existing issues for duplicates.
- I understand pull requests are limited to collaborators and maintainers will handle implementation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/lib/provider.ts and the reviewed reference implementation at commit 7803a8f7a53fa37d113adb0b469c76c988166165. Trace provider selection, model discovery, custom text requests, headers, redaction, and modality checks, then review the deterministic fetch tests and full typecheck, lint, test, and build commands. Done means both providers work without Gateway fallback, unsupported modalities fail closed, secrets are redacted, and the Apache-2.0 license is included in the repository and packed CLI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend-api-design, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100