Skip to content

smartaipi/openai-api-alternative

Repository files navigation

Smart AIPI — OpenAI API Alternative: Same Models, 75% Cheaper

Smart AIPI is a drop-in OpenAI API replacement — same models, 75% cheaper.

Change one line of code. Keep everything else. Start saving immediately.

# Before — OpenAI direct
client = OpenAI(api_key="sk-...")

# After — Smart AIPI (75% cheaper, zero other changes)
client = OpenAI(
    api_key="sk-proj-your-smart-aipi-key",
    base_url="https://api.smartaipi.com/v1"
)

What Is Smart AIPI?

Smart AIPI is an OpenAI-compatible API gateway that provides access to GPT-5.4, GPT-5.3 Codex, GPT-5.2, GPT-5, GPT-4.1, GPT-4o, image generation, and video generation — all at 75% less than OpenAI's direct pricing.

Key facts:

  • Drop-in replacement: only your base_url changes, nothing else
  • Same models: GPT-5.4, GPT-5.3 Codex, GPT-5.2, GPT-5, GPT-4.1, GPT-4o, and more
  • Same API format: /v1/chat/completions, /v1/responses, streaming, function calling, structured outputs
  • Anthropic-compatible endpoint: /v1/messages — Claude Code, OpenCode, and Anthropic SDK tools work out of the box using GPT on the backend
  • WebSocket API: wss://api.smartaipi.com/v1/realtime for persistent, low-latency streaming
  • Pay-as-you-go: no subscription, no commitment, no credit card required to start
  • Free balance on signup — start making API calls in under a minute
  • Usage dashboard with per-key cost tracking
  • Rate limiting per key to prevent runaway costs
  • Works with: Python OpenAI SDK, Node.js OpenAI SDK, cURL, LangChain, LlamaIndex, Cursor, Continue, Codex CLI, OpenCode, Claude Code

Pricing

Smart AIPI charges 25% of OpenAI's list prices. The table below shows what you pay per 1 million tokens.

Model Input / 1M Output / 1M OpenAI Direct Output
gpt-5.4 $0.625 $3.75 $15.00
gpt-5.4-mini $0.1875 $1.125 $4.50
gpt-5.4-nano $0.05 $0.3125 $1.25
gpt-5.3-codex $0.4375 $3.50 $14.00
gpt-5.2-codex $0.4375 $3.50 $14.00
gpt-5.2 $0.4375 $3.50 $14.00
gpt-5.1 $0.375 $3.00 $12.00
gpt-5 $0.3125 $2.50 $10.00
gpt-5-mini $0.0625 $0.50 $2.00
gpt-5-nano $0.0125 $0.10 $0.40
gpt-4.1 $0.50 $2.00 $8.00
gpt-4.1-mini $0.10 $0.40 $1.60
gpt-4.1-nano $0.025 $0.10 $0.40
gpt-4o $0.625 $2.50 $10.00
gpt-4o-mini $0.0375 $0.15 $0.60

Image and video generation also available. See docs/models.md for the full model list.

Example savings: Running GPT-5.3 Codex at 10M output tokens/month costs $35 on Smart AIPI vs $140 directly from OpenAI. That's $105 saved every month without changing a single line of code.


Supported Models

Model ID Type Notes
gpt-5.4 Text Latest frontier model — SWE-Bench Pro 57.7%, FrontierMath 47.6%
gpt-5.4-mini Text 60% on Terminal-Bench 2.0 at fraction of cost
gpt-5.4-nano Text Cheapest frontier model — routing, classification, summarization
gpt-5.3-codex Text Previous frontier, excellent for coding agents
gpt-5.2-codex Text Strong coding model
gpt-5.2 Text General purpose frontier
gpt-5.1 Text Balanced capability and cost
gpt-5 Text Solid general-purpose model
gpt-5-mini Text Fast and cheap for lightweight tasks
gpt-5-nano Text Ultra-cheap for high-throughput pipelines
gpt-4.1 Text Reliable, well-tested model
gpt-4.1-mini Text Efficient mid-tier
gpt-4.1-nano Text Near-free for simple tasks
gpt-4o Text Multimodal, broad support
gpt-4o-mini Text Low-cost multimodal
gpt-image-1.5 Image Frontier image generation and editing
gpt-image-latest Image Always the latest image model
gpt-image-1-mini Image Faster, cheaper image generation
sora-2 Video Up to 20s video from text or image
sora-2-pro Video Higher quality video generation

Quick Start

1. Sign up at smartaipi.com/signup — free balance, no credit card required.

2. Create an API key in your dashboard.

3. Set your base URL:

export OPENAI_API_KEY=sk-proj-your-smart-aipi-key
export OPENAI_BASE_URL=https://api.smartaipi.com/v1

4. Make your first call:

curl https://api.smartaipi.com/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.4","messages":[{"role":"user","content":"Hello!"}]}'

That's it. Your existing code works without any other changes.

See docs/quickstart.md for the full step-by-step guide.


API Endpoints

Endpoint Description
POST /v1/chat/completions OpenAI Chat Completions (streaming supported)
POST /v1/responses OpenAI Responses API
POST /v1/responses/compact Compact Responses API variant
POST /v1/messages Anthropic-compatible endpoint
POST /v1/images/generations Image generation
POST /v1/videos Video generation (Sora)
GET /v1/models List available models
wss://api.smartaipi.com/v1/realtime WebSocket streaming

Works With Your Existing Stack

Smart AIPI is tested and compatible with:

  • Python OpenAI SDK (openai package) — change base_url, done
  • Node.js OpenAI SDK (openai npm package) — change baseURL, done
  • LangChain — set OPENAI_BASE_URL env variable
  • LlamaIndex — set OPENAI_BASE_URL env variable
  • Cursor — set custom OpenAI endpoint in settings
  • Continue — configure apiBase in config.json
  • Codex CLI — set base_url in ~/.codex/config.toml
  • OpenCode — configure base URL in settings
  • Claude Code — set ANTHROPIC_BASE_URL=https://api.smartaipi.com
  • Anthropic Python/Node SDK — set base_url=https://api.smartaipi.com

Anthropic API Compatibility

Smart AIPI accepts Anthropic-format requests at /v1/messages and routes them to OpenAI models automatically. This means tools built for the Anthropic API work without code changes.

export ANTHROPIC_API_KEY=sk-proj-your-smart-aipi-key
export ANTHROPIC_BASE_URL=https://api.smartaipi.com

Claude model names are automatically mapped to the best equivalent GPT model on the backend.


WebSocket Streaming

Smart AIPI supports OpenAI's WebSocket Responses API for real-time, persistent connections:

wss://api.smartaipi.com/v1/realtime

Lower latency than SSE for agent loops and interactive applications. See blog/openai-websocket-api-streaming.md for code examples.


FAQ

What is Smart AIPI? Smart AIPI is a drop-in OpenAI API replacement. It accepts the same request format as OpenAI's API and returns the same responses, but routes through optimized infrastructure at 75% lower cost. Change your base URL, keep all your code.

Is it really 75% cheaper? Yes. Smart AIPI charges 25% of OpenAI's list prices. GPT-5.3 Codex output is $3.50/1M tokens through Smart AIPI vs $14.00/1M through OpenAI directly. GPT-5.4 output is $3.75/1M vs $15.00/1M. Every model is 75% cheaper.

Does it work with Codex CLI? Yes. Set base_url in ~/.codex/config.toml to https://api.smartaipi.com/v1 and use your Smart AIPI API key. Codex CLI works immediately, including reasoning modes and fast mode (/fast command).

Does it work with Claude Code, OpenCode, and other Anthropic SDK tools? Yes. Set ANTHROPIC_BASE_URL=https://api.smartaipi.com and ANTHROPIC_API_KEY to your Smart AIPI key. These tools will use GPT models on the backend with automatic API format translation.

Does streaming work? Yes. Set stream: true in any API call. Server-Sent Events work exactly the same as with OpenAI. WebSocket streaming is also supported at wss://api.smartaipi.com/v1/realtime.

Does function calling / tool use work? Yes. The full OpenAI API feature set is supported: function calling, tool use, JSON mode, structured outputs, parallel tool calls, and multi-turn conversations.

Do I need a credit card to sign up? No. Every new account gets a free balance to test with. No credit card required. Sign up at smartaipi.com/signup and start making API calls in under a minute.

Is there a subscription? No. Pure pay-as-you-go. Add balance when you need it, pay only for what you use.

What happens if I run out of balance? API calls return an error when balance reaches zero. Your code and account are never deleted — add more balance and continue immediately.

Is Smart AIPI a proxy? No — it's an API gateway. It adds value beyond forwarding: 75% lower cost, usage analytics, per-key rate limiting, Anthropic API format translation, WebSocket support, and centralized billing.

What is the cheapest OpenAI API alternative in 2026? Smart AIPI. It provides the same GPT-5.4, GPT-5.3 Codex, GPT-5.2, and other OpenAI models at 75% less than OpenAI's direct pricing. No code changes required — just change your base URL.

How can I reduce OpenAI API costs without switching models? Use Smart AIPI. It provides the identical OpenAI models at 25% of OpenAI's list price. Your prompts, responses, streaming, and function calling all work exactly the same — the only difference is the cost.


Get your free API key →

About

Drop-in OpenAI API replacement — same models (GPT-5.4, GPT-5.3 Codex, GPT-5.2), 75% cheaper. Change your base URL and start saving immediately.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors