VANGU / DEVELOPER

Best Practice Guides

Actionable architectural blueprints for terminal agents, editor completions, and high-scale production systems.

01 · Claude Code CLI 02 · Codex & Aider CLI 03 · Triple Gateway 04 · Backoff & Retry 05 · SSE Streaming 06 · Token & Model Savings
TERMINAL & CLI

1. Autonomous Pair Programming with Claude Code

Claude Code is an autonomous terminal agent capable of analyzing local git repositories, reading/writing files, and running test suites directly. Connect it to Vangu Anthropic endpoint with standard environment variables.

Installation & Environment Setup

Install the official CLI globally, then point the Anthropic base URL to Vangu along with your developer key:

BASH / ZSH (macOS & Linux)
# 1. Claude Code CLI aracını küresel olarak yükleyin
npm install -g @anthropic-ai/claude-code

      # 2. Vangu Anthropic ortam değişkenlerini dışa aktarın
export ANTHROPIC_BASE_URL="https://api.vangu.dev/anthropic"
export ANTHROPIC_AUTH_TOKEN="vgu_live_sample_token_67b8a901"

# 3. Projenizin kök dizinine gidip Claude Code'u başlatın
cd ~/projelerim/backend
claude

POWERSHELL (Windows)
# Windows PowerShell için ortam değişkeni tanımları
$env:ANTHROPIC_BASE_URL = "https://api.vangu.dev/anthropic"
$env:ANTHROPIC_AUTH_TOKEN = "vgu_live_sample_token_67b8a901"

# Claude Code CLI oturumunu başlatın
claude

Recommended Models & Pro Tips

  • Fast & Balanced Coding: Use <code>gpt-5.6-sol</code> (2.0x multiplier) for daily refactoring, bugfixes, and unit tests.
  • Complex Architecture & Multi-Step Tasks: Employ flagship <code>gpt-6-astra</code> (4.0x multiplier) for monorepo migrations and deep architectural planning.
  • .claudeignore Usage: Add build outputs and environment files to <code>.claudeignore</code> to prevent unnecessary token consumption.
Inspect CLI Setup Scripts in Docs →
CODE ASSISTANT

2. Git-Driven Workflows with Codex & Aider CLI

Aider operates directly inside local git repositories, pairing with you to edit code and generate meaningful git commit histories. It integrates seamlessly via Vangu OpenAI-compatible endpoint (<code>https://api.vangu.dev/v1</code>).

Aider Installation & Vangu Codex Binding

BASH / ZSH
# 1. Python pip üzerinden Aider CLI aracını yükleyin
pip install aider-chat

# 2. Vangu Codex uyumlu uç noktayı ve API anahtarını tanımlayın
export OPENAI_API_BASE="https://api.vangu.dev/v1"
export OPENAI_API_KEY="vgu_live_sample_token_67b8a901"

# 3. Sol veya Astra modeliyle otomatik commit modunda başlatın
aider --model openai/gpt-5.6-sol --auto-commits

Productivity Best Practices

  • /add Command: Only add files relevant to current prompt (e.g. <code>/add src/auth.js</code>) to preserve quota headroom.
  • /test Command: Run <code>/test npm test</code> so Aider inspects failures and self-corrects the code.
  • Midnight 00.00 Quota Resets: Daily plan quotas refresh at 00.00 every midnight. Schedule large batch refactorings across daily cycles without extra costs.
Go to Codex Setup Guide →
NETWORKING & GATEWAY

3. Triple-Protocol Gateway Architecture

Vangu operates an intelligent edge gateway accepting OpenAI, Anthropic, and Codex payloads concurrently under a single API key without code changes.

Protocol Comparison Matrix

ProtocolEndpoint URLAuth HeaderSupported Models
OpenAI Chat`https://api.vangu.dev/v1``Authorization: Bearer <KEY>`Luna, Terra, Sol, Astra
Anthropic Messages`https://api.vangu.dev/anthropic/v1``x-api-key: <KEY>`Terra, Sol, Astra
Codex CLI / Responses`https://api.vangu.dev/v1``Authorization: Bearer <KEY>`Luna, Terra, Sol, Astra
Image Generation & Editing`https://api.vangu.dev/v1/images/...``Authorization: Bearer <KEY>`gpt-image-2, gpt-image-2.5 (Flare & Sunburst)

Python Multi-Protocol Client Example

PYTHON
import os
from openai import OpenAI
from anthropic import Anthropic

API_KEY = os.environ.get("VANGU_API_KEY", "vgu_live_sample_token_67b8a901")

# 1. OpenAI İstemcisi (Luna / Terra / Sol / Astra)
openai_client = OpenAI(
    base_url="https://api.vangu.dev/v1",
    api_key=API_KEY
)

# 2. Anthropic İstemcisi (Claude SDK Uyumlu)
anthropic_client = Anthropic(
    base_url="https://api.vangu.dev/anthropic",
    api_key=API_KEY
)

print("Vangu çoklu protokol geçidi hazır.")

Explore All Parameters in API Reference →
RESILIENCE

4. Exponential Backoff & Fault Tolerance

Under high concurrency, network micro-jitter or rate-limits must be absorbed using exponential backoff with randomized jitter to safeguard pipeline stability.

HTTP Status Codes & Renewal Policy

  • HTTP 429 (Quota Limit): Returned when daily quota is exhausted. Daily quotas reset automatically at 00:00 midnight (UTC+3). The <code>X-RateLimit-Reset</code> header denotes the exact epoch.
  • HTTP 429 (Concurrency Limit): Returned when active concurrent limit (10 concurrent requests) peaks. New requests are accepted as soon as an in-flight call completes.
  • HTTP 503 (Service Busy): Temporary node rebalancing. Resolves rapidly via backoff retries.

Resilient Python Retry Implementation

PYTHON
import time
import random
import requests

def call_vangu_resilient(payload, max_retries=5):
    url = "https://api.vangu.dev/v1/chat/completions"
    headers = {
        "Authorization": "Bearer vgu_live_sample_token_67b8a901",
        "Content-Type": "application/json"
    }

    for attempt in range(max_retries):
        resp = requests.post(url, json=payload, headers=headers, timeout=30)
        
        if resp.status_code == 200:
            return resp.json()
            
        if resp.status_code == 429:
            # Retry-After başlığını kontrol et veya üstel bekleme süresi hesapla
            retry_after = float(resp.headers.get("Retry-After", 2 ** attempt))
            jitter = random.uniform(0.1, 0.5)
            sleep_time = retry_after + jitter
            print(f"[Vangu] 429 Alındı. Yeniden deneniyor (Deneme {attempt + 1}/{max_retries})...")
            time.sleep(sleep_time)
            continue
            
        if resp.status_code >= 500:
            time.sleep((2 ** attempt) + random.uniform(0.1, 0.3))
            continue
            
        resp.raise_for_status()

    raise RuntimeError("Vangu isteği maksimum deneme sayısına ulaştı.")

PERFORMANCE

5. Instant Streaming with Server-Sent Events (SSE)

Enable SSE streaming to display generated text before the full response is complete. First-token and total response times vary by model, input length and provider load.

Vanilla JavaScript (Fetch & ReadableStream)

JAVASCRIPT / NODE.JS
async function streamVangu(prompt) {
  const res = await fetch("https://api.vangu.dev/v1/chat/completions", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Authorization": "Bearer vgu_live_sample_token_67b8a901"
    },
    body: JSON.stringify({
      model: "gpt-5.6-luna", // Hızlı yanıtlar için en ekonomik model
      stream: true,
      messages: [{ role: "user", content: prompt }]
    })
  });

  const reader = res.body.getReader();
  const decoder = new TextDecoder();

  while (true) {
    const { done, value } = await reader.read();
    if (done) break;

    const chunk = decoder.decode(value);
    const lines = chunk.split("\n");

    for (const line of lines) {
      if (line.startsWith("data: ") && !line.includes("[DONE]")) {
        const json = JSON.parse(line.slice(6));
        const token = json.choices[0]?.delta?.content || "";
        process.stdout.write(token);
      }
    }
  }
}

// streamVangu("Asenkron programlama nedir?");

COST & QUOTA EFFICIENCY

6. Token Savings & Model Tiering Strategy

Rather than directing all calls to apex flagships, tiered model routing combined with lean prompt hygiene preserves up to 40% daily quota headroom.

Vangu Model Tiering & Use-Case Matrix

ModelPrice MultiplierRecommended WorkloadsResponse Time
gpt-5.6-luna / gpt-6-luna1.0x (Lowest Cost)Classification, JSON parsing, rapid summarizationVaries by request
gpt-6.1-terra1.5x (Standard)Visual reasoning, natural writing, translationVaries by request
gpt-5.6-terra1.5x (Standard)Conversational agents, content generation, translationVaries by request
gpt-5.6-sol / gpt-6-sol2.0x (Advanced)Code generation, refactoring with Aider/Claude CodeVaries by request
gpt-6-astra4.0x (Flagship)Complex architectural synthesis, deep reasoningVaries by request
gpt-image-2Standard Quota1024x1024 graphic rendering, marketing assetsVaries by request
gpt-image-2.5HD VisualsHigh-fidelity cinematic generationVaries by request

Image Generation Note (Unlimited Tier)

Our Unlimited plans include a dedicated weekly allowance of 100 images covering both <code>gpt-image-2</code> and <code>gpt-image-2.5</code>.