01

How it works

CamelLayer optimizes your AI coding prompts in 5 simple steps.

  1. 1.You type a prompt in any language (Turkish, German, French, etc.)
  2. 2.The UserPromptSubmit hook fires and sends the prompt to CamelLayer API
  3. 3.CamelLayer detects language, fixes typos, compresses, and translates to English
  4. 4.Optimized English prompt is returned (848ms avg latency)
  5. 5.Claude receives the clean English prompt and responds normally
02

Claude CLI

CamelLayer integrates via the UserPromptSubmit hook — intercepting every prompt before it reaches Claude.

Install

bash
curl -sSL https://api.camellayer.com/install | bash -s -- YOUR_LICENSE_KEY

This downloads the hook and configures Claude CLI automatically.

03

Gemini CLI

Source the CamelLayer shell wrapper in your shell profile to enable automatic optimization for Gemini CLI.

~/.zshrc or ~/.bashrc
export CAMEL_LICENSE_KEY="cml_your_key"
source <(curl -sSL \
  https://api.camellayer.com/integrations/gemini-cli.sh)
04

Codex CLI

Source the CamelLayer shell wrapper in your shell profile to enable automatic optimization for Codex CLI.

~/.zshrc or ~/.bashrc
export CAMEL_LICENSE_KEY="cml_your_key"
source <(curl -sSL \
  https://api.camellayer.com/integrations/codex-cli.sh)
05

Copilot CLI

Shell wrapper for GitHub Copilot CLI. Works the same way as the Gemini and Codex wrappers.

~/.zshrc or ~/.bashrc
export CAMEL_LICENSE_KEY="cml_your_key"
source <(curl -sSL \
  https://api.camellayer.com/integrations/copilot-cli.sh)
06

Proxy Mode

True prompt replacement via local reverse proxy. Unlike hook mode which appends context, proxy mode replaces Turkish text with English directly in the API request — saving real tokens.

Hook Mode vs Proxy Mode

Hook Mode
  • No dependencies, instant setup
  • Appends optimized prompt as context
  • Works with all CLI tools
  • Requires license key
Proxy Mode
  • True prompt replacement (real token savings)
  • Runs locally, no API calls to CamelLayer
  • Claude Code only
  • Requires Python 3 + Gemini API key

Install

bash
curl -sSL https://api.camellayer.com/proxy-install | bash -s -- YOUR_GEMINI_API_KEY

This installs the proxy, sets ANTHROPIC_BASE_URL to route Claude Code through the proxy, and starts it automatically.

Commands

bash
camel-proxy start     # Start the proxy
camel-proxy stop      # Stop the proxy
camel-proxy restart   # Restart the proxy
camel-proxy status    # Check proxy status
camel-proxy logs      # View proxy logs

Uninstall

bash
curl -sSL https://api.camellayer.com/proxy-install | bash -s -- --uninstall
07

Benchmark Results

1,600 test cases across 14 categories. Includes typo-heavy inputs, code blocks, multi-language mixing, and real-world developer prompts.

Test Methodology

Dataset
  • 1,600 programmatically generated test cases
  • 14 distinct categories covering real-world developer scenarios
  • Mix of hand-crafted adversarial cases + automated generation
  • Primary language: Turkish (with German, French, Spanish validation)
Test Categories
  • Typo-heavy inputs (garbled ASCII, missing special chars)
  • Code blocks (Python, TypeScript, Go, Rust, SQL, YAML, Docker)
  • Multi-language mixing (Turkish text with English technical terms)
  • Skip detection (pure English, slash commands, short prompts)
Environment
  • Provider: Gemini 2.5 Flash Lite (primary), GPT-4.1 Nano (fallback)
  • Server: Google Cloud Run (europe-west1)
  • Latency measured end-to-end including network overhead
  • Each test case run once with cold/warm mix
Pass Criteria
  • Non-English text must be detected and translated
  • Code blocks and technical terms must be preserved verbatim
  • English text and slash commands must be skipped (not optimized)
  • Token count of output must be ≤ input token count
100%
Overall Pass Rate
41.3%
Avg Token Savings
848ms
Avg Latency
100%
Skip Accuracy
99%
Typo Correction
0%
False Positives

Results by Category

Category
Pass Rate
Avg Savings
Latency
Error Messages
100%
13.3%
689ms
Frontend Dev
100%
16.7%
532ms
Long Prompts
100%
22.3%
697ms
Mixed TR-EN
100%
17.8%
489ms
Security
100%
7.8%
525ms
Skip English
100%
Skip Code
100%
Typo Heavy
99%
44.2%
486ms
Typo Light
99%
54.2%
490ms
Multi-Step
98%
35.4%
486ms
Database Ops
90%
30.6%
483ms
Basic Commands
80%
42.0%
494ms
Code Blocks
80%
3.5%
484ms
Infrastructure
80%
19.3%
501ms

Highlights

  • Turkish text uses 1.96x more tokens than English (96% overhead)
  • Code blocks are preserved 100% of the time
  • Zero false positives — English prompts are never incorrectly optimized

Known Limitations

  • Short ASCII Turkish (under ~20 chars) with mostly English technical terms may not be detected — accounts for 13.8% of failures. This is by design to prevent false positives on English prompts.
  • Prompts starting with / are treated as slash commands and skipped. Workaround: prefix with natural language.
08

API Reference

Base URL: https://api.camellayer.com

POST/api/v1/optimize

Optimize a prompt. Detects language, fixes typos, compresses, and translates to English.

Try it

bash
curl -X POST https://api.camellayer.com/api/v1/optimize \
  -H "Content-Type: application/json" \
  -H "X-License-Key: YOUR_LICENSE_KEY" \
  -d '{"prompt": "Login sayfasindaki authenticaton bugini duzelt.", "is_first_message": false}'

Headers

X-License-KeyYOUR_LICENSE_KEY
Content-Typeapplication/json

Response

200 OK
{
  "optimized": "Fix the authentication bug on the login page.",
  "detected_language": "tr",
  "original_chars": 47,
  "optimized_chars": 45,
  "original_tokens": 14,
  "optimized_tokens": 9,
  "savings_pct": 35.7,
  "provider": "gemini-2.5-flash-lite",
  "latency_ms": 412,
  "tier": "free"
}

Skip Conditions

  • Prompt is already in English and has no typos
  • Prompt contains only code blocks
  • Prompt is shorter than 10 characters
  • is_first_message: true and system prompt detected

When skipped, skipped: true is returned and the original prompt is passed through unchanged.

Rate Limits
Plan
Limit
Window
Free
200 requests
12 hours
Pro
100 requests
per minute
GET/api/v1/health

Check API availability. No authentication required.

bash
curl https://api.camellayer.com/api/v1/health
Response
{"status": "ok", "version": "0.2.0"}
POST/api/v1/validate-key

Validate a license key.

bash
curl -X POST https://api.camellayer.com/api/v1/validate-key \
  -H "X-License-Key: YOUR_LICENSE_KEY"
Response
{"valid": true}

Supported Languages

TR TurkishDE GermanFR FrenchES SpanishPT PortugueseRU RussianZH ChineseJA JapaneseKO KoreanAR Arabic
09

Uninstall

One command to remove CamelLayer. Choose the uninstall command matching your installation mode.

Hook Mode

bash
curl -sSL https://api.camellayer.com/install | bash -s -- --uninstall
What it removes
  • +~/.claude/hooks/camel-optimize.sh — the hook script
  • +Hook and env var from ~/.claude/settings.json
  • +CAMEL_LICENSE_KEY and integration scripts from shell profile

Proxy Mode

bash
curl -sSL https://api.camellayer.com/proxy-install | bash -s -- --uninstall
What it removes
  • +Stops the running proxy and removes ~/.camel/proxy.* files
  • +ANTHROPIC_BASE_URL and GEMINI_API_KEY from shell profile

Restart your terminal after uninstalling for changes to take effect.

Troubleshooting

If the optimization is not working after installation, you can check the debug log to diagnose the issue.

bash
# Claude Code hook debug log
cat /tmp/camel-hook-debug.log

# Gemini CLI debug log
cat /tmp/camel-gemini-debug.log

# Codex CLI debug log
cat /tmp/camel-codex-debug.log

# Copilot CLI debug log
cat /tmp/camel-copilot-debug.log

The log shows each step: input received, prompt extracted, API call, and output sent. Common issues:

  • No log file — the hook is not running. Verify ~/.claude/settings.json has the UserPromptSubmit hook entry.
  • CAMEL_LICENSE_KEY: NO — reinstall with curl -sSL https://api.camellayer.com/install | bash -s -- YOUR_KEY
  • Empty API response — check your internet connection or API status at /api/v1/health

You can also verify your key is valid:

bash
curl -X POST https://api.camellayer.com/api/v1/validate-key \
  -H "X-License-Key: YOUR_LICENSE_KEY"