API Reference

AEVNI Public API

Optimize and create prompts programmatically from any app or pipeline.

Base URL: https://aevni.website/api/v1  ·  All requests and responses use JSON.

The AEVNI API exposes two operations:

  • Optimize — reduce the token count of an existing prompt while preserving intent.
  • Create — generate a well-structured prompt from a plain-language description.

Both endpoints are authenticated and require an X-AEVNI-Key header. You also bring your own LLM API key via X-Provider-Key.


⚡ Playground

Probá la API en vivo con tu propia AEVNI key. Las keys quedan solo en tu navegador.


Authentication

Every request must include two headers:

HeaderDescription
X-AEVNI-Key Your AEVNI platform key. Identifies your account and tracks usage. Contact us to get one.
X-Provider-Key Your LLM provider API key (Gemini, OpenAI, etc.). Only required for paid providers. Never sent to external servers — used only to call the selected provider.

Alternatively, pass api_key in the JSON body instead of X-Provider-Key.

# Example — curl
curl -X POST https://aevni.website/api/v1/optimize \
  -H "Content-Type: application/json" \
  -H "X-AEVNI-Key: aevni_your_key_here" \
  -H "X-Provider-Key: AIza..." \
  -d '{"prompt": "Explain quantum entanglement", "provider": "gemini", "mode": "pro"}'

Errors

All errors return a JSON body with error (human-readable message) and code (machine-readable slug).

HTTPCodeMeaning
400bad_provider / bad_modeInvalid parameter value.
401missing_keyX-AEVNI-Key header is absent.
401invalid_keyX-AEVNI-Key is invalid or revoked.
401missing_provider_keyThe selected provider requires an API key.
413prompt_too_longPrompt exceeds 500 000 characters.
429rate_limitedProvider quota exhausted or our rate limit hit.
503provider_unavailableProvider is down or unreachable.
500internal_errorUnexpected server error.
{
  "error": "API key inválida o revocada.",
  "code":  "invalid_key"
}

Rate limits

Both v1 endpoints allow 60 requests per minute per IP. Beyond that you'll receive HTTP 429. Provider-side rate limits (Gemini RPM, etc.) are separate — the rate_limited code distinguishes them.


POST /v1/optimize

POST https://aevni.website/api/v1/optimize

Reduce the token count of an existing prompt while preserving its meaning, structure, and intent.

Request body

FieldTypeDescription
promptstringrequiredThe prompt to optimize. Max 500 000 characters.
providerstringoptionalLLM provider. Default: gemini. See Providers.
modestringoptionalpro | lite | auto. Default: pro. See Modes.
api_keystringoptionalProvider API key. Alternative to X-Provider-Key header.

Response

{
  "optimized":      "...",          // optimized prompt in original language
  "optimized_en":   "...",          // English version (often saves more tokens)
  "detected_lang":  "es",          // "es" or "en"
  "prompt_type":    "task_structured",
  "report": {
    "original_tokens":      120,
    "optimized_tokens":     74,
    "optimized_en_tokens":  68,
    "tokens_saved":         46,
    "token_reduction_pct":  38.3,
    "chars_saved":          210,
    "density_original":     4.2,
    "density_optimized":    5.1,
    "detected_language":    "es"
  },
  "recommendation": {
    "model":       "gemini-2.5-flash",
    "reason":      "...",
    "cost_tier":   "low"
  },
  "meta": {
    "provider":      "gemini",
    "mode":          "pro",
    "mode_resolved": "pro"
  }
}

Example

curl -X POST https://aevni.website/api/v1/optimize \
  -H "Content-Type: application/json" \
  -H "X-AEVNI-Key: aevni_..." \
  -H "X-Provider-Key: AIza..." \
  -d '{"prompt":"You are an expert assistant. Your job is to help users with their questions in a kind and friendly manner. Always be polite.","provider":"gemini","mode":"auto"}'

POST /v1/create

POST https://aevni.website/api/v1/create

Generate a well-structured prompt from a plain-language description of what you need.

Request body

FieldTypeDescription
descriptionstringrequiredWhat the prompt should do. Free-form natural language.
providerstringoptionalDefault: pollinations (free). See Providers.
requirementsstringoptionalOne requirement per line (bullets OK). Or pass an array of strings.
output_formatstringoptionalDescribe the desired output structure (e.g. "JSON array of objects").
tonestringoptionalneutral | formal | technical | simple | direct. Default: neutral.
audiencestringoptionalgeneral | developer | manager | student | expert. Default: general.
forced_typestringoptionalForce a structural type. One of the types in Prompt types.
api_keystringoptionalProvider API key. Alternative to X-Provider-Key.

Response

{
  "prompt_type":        "task_structured",
  "created_prompt_es":  "...",   // prompt in user's language
  "created_prompt_en":  "...",   // English version
  "tokens_es":          95,
  "tokens_en":          88,
  "explanation":        "Why this structure was chosen...",
  "tips":               ["Add examples to improve accuracy", "..."],
  "meta": {
    "provider":    "pollinations",
    "tone":        "technical",
    "audience":   "developer",
    "forced_type": null
  }
}

Example

curl -X POST https://aevni.website/api/v1/create \
  -H "Content-Type: application/json" \
  -H "X-AEVNI-Key: aevni_..." \
  -d '{"description":"A customer support agent for a SaaS app","tone":"formal","audience":"general","provider":"pollinations"}'

Providers

Pass the provider string in your request body.

IDNameKey required?Notes
pollinationsPollinations AINo — freeDefault for /create. No API key needed.
geminiGoogle Gemini 2.5 FlashYesDefault for /optimize. Best quality.
openaiOpenAI GPT-4o miniYes
groqGroq — Llama 3.3 70BYesFastest inference.
deepseekDeepSeek ChatYes
cerebrasCerebras — 120BYes
sambanovaSambaNova — Llama 3.3 70BYes
openrouterOpenRouter — Llama 3.1 8BYesFree tier available on OpenRouter.
anthropicAnthropic Claude HaikuYes

Modes

ModeDescription
proDeep optimization with XML schema enforcement. Best for structured/complex prompts.
liteFast compression without structural rewriting. Good for short conversational prompts.
autoAutomatically picks pro or lite based on prompt complexity heuristics.

Prompt types

AEVNI detects the structural type of your prompt automatically. You can override it with forced_type in /v1/create.

TypeDescription
task_structuredPrompts with explicit sections: role, task, constraints, output format.
conversationalShort questions or natural-language requests without formal structure.
system_promptAgent persona/instruction blocks (system-role prompts).
agenticMulti-step reasoning or tool-use prompts.
creativeWriting, storytelling, or open-ended creative tasks.

Questions? hola@aevni.website  ·  Back to app