Skip to content

Instantly share code, notes, and snippets.

View moinulmoin's full-sized avatar
:shipit:
building

Moinul Moin moinulmoin

:shipit:
building
View GitHub Profile
@moinulmoin
moinulmoin / try-catch.ts
Created March 22, 2025 10:42
Go like error handling for promises in TS
/**
* Wraps a promise and returns a tuple where the first element is the data if successful,
* or null if an error occurred, and the second element is the error if any, or null if successful.
*
* @param promise The promise to wrap.
* @returns A promise that resolves to [data, null] on success or [null, error] on failure.
*/
export async function tryCatch<T, E = Error>(promise: Promise<T>): Promise<[T, null] | [null, E]> {
try {
const data = await promise;
@moinulmoin
moinulmoin / config.json
Created December 12, 2025 14:17
Latest Factory CLI custom models config with CLIPROXYAPI, you can use with your Google AI, Claude, Chatgpt subscriptions
{
"custom_models": [
{
"model_display_name": "GPT 5.2 Medium",
"model": "gpt-5.2(medium)",
"base_url": "http://localhost:8317/v1",
"api_key": "dummy-not-used",
"provider": "openai"
},
{
@moinulmoin
moinulmoin / AMP-FREE-TIER-GUIDE.md
Last active February 8, 2026 16:00
AMP Free Tier + Local OAuth Fallback Guide — Use AMP's free $10/day first, auto-fallback to your local OAuth subs (Claude, Gemini, Codex, Copilot, Kiro)

AMP Free Tier + Local OAuth Fallback Guide

Use AMP's free $10/day grant first. When exhausted, switch to your own subscriptions (Claude, Gemini, Codex, GitHub Copilot, Kiro, etc.) — all from within AMP CLI. No restart needed.

Prerequisites: Add Prefer-Upstream Feature

CLIProxyAPI / CLIProxyAPIPlus doesn't include the prefer-upstream feature out of the box. You need to add it first.

Drop IMPLEMENT-PREFER-UPSTREAM.md into your AI coding agent (Claude Code, AMP, Cursor, etc.) and ask it to implement the changes. It's 7 small edits that follow the existing ForceModelMappings pattern.