For Developers

One line of code.
Every AI prompt optimized.

Drop-in proxy compatible with OpenAI and Anthropic SDKs. Your users type naturally. Safyan makes every prompt better before the AI sees it. Better prompts, better responses, zero user friction.

The One-Line Change JavaScript
// Before — your app talks to OpenAI directly const client = new OpenAI({ baseURL: 'https://api.openai.com/v1' }); // After — Safyan optimizes every prompt automatically const client = new OpenAI({ baseURL: 'https://safyan.ai/v1' }); // That's it. Same code. Same API. Better responses. const response = await client.chat.completions.create({ model: 'safyan-auto', // or 'gpt-4o', 'claude-sonnet-4-20250514', etc. messages: [{ role: 'user', content: userInput }] });
Works with Anthropic too Python
# Before client = Anthropic(base_url="https://api.anthropic.com") # After — every prompt optimized client = Anthropic(base_url="https://safyan.ai") # Exact same API. Safyan sits in the middle. message = client.messages.create( model="safyan-auto", max_tokens=1024, messages=[{"role": "user", "content": user_input}] )
How It Works

What happens in that one line

Safyan intercepts the request, optimizes the prompt using 16 mathematical primitives, routes to the best model, and returns the response. Your app gets smarter without changing a single line of business logic.

01

Intercept

Your app sends a normal API request. Safyan receives it.

02

Optimize

7 Cures applied. Noise stripped. Intent locked. Constraints added.

03

Route

Domain-aware routing picks the best model for the task.

04

Return

Better response, same format. Your code doesn't change.

SDK

Full control when you want it

The SDK gives you direct access to Safyan's optimization engine. Optimize prompts, compile them, score them, grade AI responses.

npm install safyan-sdk JavaScript
const { Safyan } = require('safyan-sdk'); const safyan = new Safyan({ apiKey: 'sfk_...' }); // Optimize any prompt const result = await safyan.optimize('help me with my code'); console.log(result.translation); // "Act as a senior software engineer. Debug the following..." // Score a prompt (0-100, instant, no API call) const score = await safyan.score('make it better'); // { total: 12, grade: 'F', label: 'Vague' } // Full chat with automatic optimization const response = await safyan.chat([ { role: 'user', content: 'build me a login page' } ], { model: 'safyan-auto' }); // Stream responses for await (const chunk of safyan.chatStream(messages)) { process.stdout.write(chunk.content); }
What You Get

Every response includes Safyan intelligence

7

Cures Applied

Every prompt is analyzed for 7 common mistakes. Noise stripped, intent locked, constraints added, expert role assigned.

16

Primitives

Mathematical operations on the AI's output distribution. PRIME, LOCK, BOUND, SHAPE, GROUND, NEGATE, and 10 more.

5

AI Models

Domain-aware routing across Claude, GPT-4o, DeepSeek. Code goes to reasoning models. Creative goes to generative ones.

Embeddable Widget

Teach your users to communicate better

Drop the Safyan Score widget into any page. It scores prompts in real-time, shows which of the 7 Cures the user needs, and tracks improvement over time.

One script tag HTML
<!-- Add to any page --> <script src="https://safyan.ai/widget/safyan-score.js" data-position="bottom-right"></script> <!-- Or programmatic --> <script> SafyanScore.init({ position: 'bottom-right' }); // Score any text programmatically const score = SafyanScore.score('help me with stuff'); // { total: 17, grade: 'F', breakdown: { noise: 5, ... } } </script>
Metadata

Full transparency in every response

Every proxy response includes Safyan metadata so you can see exactly what was optimized and why.

Response Headers + Body Extension HTTP
// Response headers X-Safyan-Primitives: PRIME,LOCK,BOUND,SHAPE,NEGATE X-Safyan-Mode: code X-Safyan-Score-Before: 22 X-Safyan-Score-After: 78 // Response body includes safyan object { "id": "sfyn-chatcmpl-...", "choices": [...], "safyan": { "safyan_primitives": ["PRIME", "LOCK", "BOUND", "SHAPE", "NEGATE"], "safyan_mode": "code", "score_before": 22, "score_after": 78, "score_delta": 56, "grade_before": "F", "grade_after": "B" } }
Pricing

Pay per optimization, scale infinitely

No monthly minimums. No per-seat pricing. Just pay for what you use.

Developer

Free
100 optimizations/day
  • OpenAI-compatible proxy
  • Anthropic-compatible proxy
  • All 7 translation modes
  • Score + grade endpoints
  • Community support
Get Started

Enterprise

Custom
volume pricing
  • Everything in Pro
  • Custom model routing
  • Dedicated infrastructure
  • SLA guarantees
  • Custom primitives
  • Direct engineering support
Contact Us
Quickstart

Live in 5 minutes

1. Get your API key

Go to safyan.ai/console. Your key starts with sfk_. Works immediately.

2. Change baseURL

Point your OpenAI or Anthropic SDK to safyan.ai/v1. Pass your Safyan key as the bearer token.

3. Ship

Every prompt your users type now gets optimized. Better AI responses. Zero user friction. Done.