Integrate multiple AI models through one documented API
Welcome to the All AI Ask Public API. This API allows you to programmatically compare multiple LLMs and evaluate their outputs using AI judges.
Endpoint
POST https://api.allaiask.com/api/v1/prompt
Authentication
Include your API key in the request headers:
Authorization: Bearer <YOUR_API_KEY>
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | The prompt text to send to the models. |
models | string[] | Yes | Array of model IDs to generate responses from. |
judges | string[] | No | Array of model IDs to use as judges for comparing the outputs. |
judge_prompt | string | No | Custom grading instructions for judges (e.g. "Focus on technical accuracy"). |
judge_weights | object | No | Weights for the judge (accuracy, speed, cost). Default: 1, 0, 0. |
attachments | object[] | No | Array of base64 encoded files (images/PDFs depending on model support). |
system_prompt | string | No | Custom instructions to set model behavior/persona. |
generation_settings | object | No | Optional parameters like temperature, maxTokens, topP. |
response_schema | object | No | Optional JSON schema to force a shared structured output across all models. |
model_tuning | object | No | Per-model fine-tuning options (thinking budget, reasoning effort). See below. |
zero_data_retention | boolean | No | Prevent prompt text, system prompt, model outputs, and judge reasoning/metadata from being logged persistently in database records. Default: false (or user profile preference). |
Attachments Object
{
"name": "image.png",
"type": "image/png",
"base64": "..."
}
Judging Weights Object
Balance the priorities for the judge evaluation. All values are 0.0 to 1.0.
{
"accuracy": 1.0,
"speed": 0.5,
"cost": 0.2
}
Generation Settings Object
Fine-tune how models generate responses.
{
"temperature": 0.7, // 0.0 to 2.0 (Lower = deterministic, Higher = creative)
"maxTokens": 1024, // Limit the length of the generated response
"topP": 1.0 // Nucleus sampling threshold
}
Structured Outputs (Response Schema)
Force all models to output valid JSON matching a specific schema. Native schema enforcement is used for OpenAI, Gemini, Groq (select models), and Amazon Bedrock/Nova (via Converse forced tool use); other providers receive a strengthened prompt instruction. Using a shared schema allows for consistent comparison and automated evaluation.
{
"type": "object",
"properties": {
"summary": { "type": "string" },
"confidence": { "type": "number" }
},
"required": ["summary", "confidence"],
"additionalProperties": false
}
[!IMPORTANT] To ensure compatibility with OpenAI's strict mode, always include
"additionalProperties": falsein your schema objects.
Model Tuning Object
Pass per-model fine-tuning parameters keyed by model ID. This object must be assigned to the "model_tuning" field in your request payload. Only set values you want to override — omitted models use defaults.
{
"model_tuning": {
"claude-sonnet-4-6": { "thinkingBudget": 8000 },
"gemini-3.5-flash": { "thinkingBudget": 8192, "webSearch": true },
"o3-mini": { "reasoningEffort": "high" },
"grok-4.3": { "reasoningEffort": "medium" }
}
}
| Model | Parameter | Type | Description |
|---|---|---|---|
claude-sonnet-4-6, claude-opus-4-7, claude-opus-4-6 | thinkingBudget | integer | Extended thinking token budget (1024–32000). Set 0 to disable. |
gemini-3.5-flash, gemini-3.1-pro, gemini-3.1-flash, gemini-3.1-flash-lite | thinkingBudget | integer | Gemini thinking token budget (0–24576). Set 0 to disable. |
gemini-3.5-flash, gemini-3.1-pro, gemini-3.1-flash, gemini-3.1-flash-lite | webSearch | boolean | Enable Google Search grounding (web search). |
o3-mini, o3, o4-mini, gpt-5.4-pro, gpt-5.4, gpt-5.4-mini, gpt-5.4-nano, gpt-5, gpt-5-mini, gpt-5-nano | reasoningEffort | string | "low", "medium", or "high". Controls reasoning compute spend. |
grok-4.20-0309-reasoning, grok-4.3 | reasoningEffort | string | "none", "low", "medium", or "high". Controls reasoning compute spend. |
cerebras-gpt-oss-120b, cerebras-glm-4.7 | reasoningEffort | string | "low", "medium", or "high". Controls reasoning compute spend on Cerebras. |
[!NOTE] Amazon Nova models (
nova-pro,nova-lite,nova-micro) and Mistral models do not expose reasoning/thinking tuning parameters — omit them frommodel_tuning.
Example Request
curl -X POST https://api.allaiask.com/api/v1/prompt \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"prompt": "What are the benefits of side-by-side LLM comparison?",
"models": ["gpt-4.1", "claude-sonnet-4-6", "gemini-3.1-pro"],
"judges": ["o3-mini"],
"judge_weights": { "accuracy": 1, "speed": 0.5 },
"judge_prompt": "Evaluate the clarity and technical depth of the explanations.",
"zero_data_retention": true,
"model_tuning": {
"claude-sonnet-4-6": { "thinkingBudget": 4000 },
"gemini-3.1-pro": { "webSearch": true }
},
"generation_settings": {
"temperature": 0.7,
"maxTokens": 1024
},
"response_schema": {
"type": "object",
"properties": {
"answer": { "type": "string" }
}
}
}'
Supported Models
You can use any of these IDs in the models array.
[!IMPORTANT] Models are routed by
modelId, not by a separate provider field. EachmodelIdis globally unique and the gateway maps it to the correct provider internally. You never specify a provider — just the ID.The same underlying model served by more than one provider has a distinct
modelId. The provider is encoded in the ID (usually as a prefix), so there is never a collision. For example, OpenAI'sgpt-oss-120bopen-weight model is available on two providers:
modelIdProvider Notes gpt-oss-120bGroq Low time-to-first-token (~60–120ms) cerebras-gpt-oss-120bCerebras ~2–3× higher throughput on long outputs To compare the same model across providers, simply list both IDs:
"models": ["gpt-oss-120b", "cerebras-gpt-oss-120b"]. They run as independent entries and appear as separate results in the response.
Reasoning & Flagship Models
The most capable models for complex problem solving, reasoning, and advanced logic.
gpt-5.4(OpenAI)gpt-5.4-pro(OpenAI)gpt-5(OpenAI)gpt-4.1(OpenAI)gpt-4o(OpenAI)o3-mini(OpenAI)grok-4.20-0309-reasoning(xAI)claude-opus-4-6(Anthropic)claude-sonnet-4-6(Anthropic)gemini-3.1-pro(Google)gpt-oss-120b(Groq/OpenAI)cerebras-gpt-oss-120b(Cerebras/OpenAI)cerebras-glm-4.7(Cerebras/Z.ai)deepseek-v4-pro(DeepSeek)mistral-large(Mistral)nova-pro(Amazon Bedrock)
Fast & Efficient Models
Optimized for high-speed, cost-effective multimodal chat and generation.
gpt-5.4-mini(OpenAI)gpt-5.4-nano(OpenAI)gpt-5-mini(OpenAI)gpt-5-nano(OpenAI)grok-4.20-0309-non-reasoning(xAI)grok-4.3(xAI)claude-haiku-4-5(Anthropic)gemini-3.5-flash(Google)gemini-3.1-flash-lite(Google)llama-4-scout(Groq)gpt-oss-20b(Groq/OpenAI)qwen3-32b(Groq)deepseek-v4-flash(DeepSeek)mistral-medium(Mistral)mistral-small(Mistral)ministral-8b(Mistral) — cheapest flat-rate optioncodestral(Mistral) — code-specialisednova-lite(Amazon Bedrock)nova-micro(Amazon Bedrock) — cheapest, fastest budget model
Legacy / Dated Models
These models are still fully supported by the API but have been superseded by newer generations.
gpt-4o-mini(OpenAI)gpt-4-turbo(OpenAI)claude-sonnet-4.5(Anthropic)claude-opus-4.5(Anthropic)claude-opus-4.1(Anthropic)claude-sonnet-4(Anthropic)claude-opus-4(Anthropic)gemini-3.1-flash(Google)gemini-2.5-flash(Google)gemini-2.5-flash-lite(Google)llama-3.3-70b(Groq)llama-3.1-8b(Groq)grok-3(xAI)grok-3-mini(xAI)
Supported Judges
While most models can technically judge, we recommend using these IDs in the judges array for the most reliable evaluations:
- Primary Choice:
gpt-5.4-proorgpt-4.1 - Alternative:
claude-opus-4-6orgemini-3.1-pro - Specialized Reasoning:
grok-4.20-0309-reasoningordeepseek-v4-pro
Note: Judging involve a "position swap" test (running the evaluation twice) to ensure consistency and eliminate bias. When judges are requested in the API, the response will wait for these evaluations to complete before returning.
Response Body
| Field | Type | Description |
|---|---|---|
promptLogId | string | Unique identifier for the request. |
results | object[] | Array of outputs from each requested model. |
evaluations | object[] | Array of judging results (pairwise comparisons). |
creditsUsed | number | Total credits deducted from your balance for this request. |
Result Object
{
"modelId": "gpt-4o-mini",
"status": "completed",
"output": "The response text...",
"tokensIn": 150,
"tokensOut": 320,
"latencyMs": 850,
"providerCost": 0.00015 // Raw cost from the provider
}
Context & Prompt Caching
To optimize performance and reduce API usage costs, several providers supported by the All AI Ask platform offer context/prompt caching. This allows you to cache large, repetitive inputs (such as system instructions, file contents, or extensive chat history).
1. Automatic Caching
For the following providers, caching is fully automatic at the infrastructure level. You do not need to make any API request changes; the platform will automatically reuse cache segments when matching prefixes are sent:
- OpenAI: Automatically caches identical prompt prefixes $\ge$ 1,024 tokens. Match segments receive a 50% discount on input tokens.
- DeepSeek: Automatically caches identical prompt prefixes in multiples of 64 tokens. Matches receive a 90% discount on input tokens.
- Mistral: Automatically caches identical prompt prefixes at their gateway.
2. Explicit Caching: Anthropic (Claude)
Anthropic allows explicit prompt caching for large system instructions, history, or attachments.
- Requirement: Minimum prompt length of 1,024 tokens (Sonnet/Opus) or 2,048 tokens (Haiku). Up to 4 breakpoints can be declared.
- Implementation: Specify
"cache_control": { "type": "ephemeral" }within thesystem_promptarray or on specifichistoryelements.
Example Request (Anthropic Caching)
{
"prompt": "Evaluate the new code edits.",
"models": ["claude-sonnet-4-6"],
"system_prompt": [
{
"type": "text",
"text": "You are a senior code reviewer with 20+ years of experience...",
"cache_control": { "type": "ephemeral" }
}
],
"history": [
{
"role": "user",
"content": "Here is the codebase: [insert massive codebase files...]",
"cache_control": { "type": "ephemeral" }
},
{
"role": "assistant",
"content": "Understood. I have reviewed the codebase structure."
}
]
}
3. Explicit Caching: Google (Gemini)
Gemini supports explicit context caching for extremely large files, videos, or prompt chains.
- Requirement: Minimum of 32,768 tokens (often equivalent to ~1 hour of audio/video or a massive codebase).
- Implementation:
- Create a cache resource directly via Google's Gemini API
/cachedContentsendpoint using your API credentials. - Pass the returned cache name string (e.g.,
cachedContents/1234abcd) in the"model_tuning"field under"cachedContent"for your Gemini model.
- Create a cache resource directly via Google's Gemini API
Example Request (Gemini Caching)
{
"prompt": "Summarize key findings from this video.",
"models": ["gemini-3.1-pro"],
"model_tuning": {
"gemini-3.1-pro": {
"cachedContent": "cachedContents/1234567890abcdef"
}
}
}
Error Codes
- 400: Missing prompt or invalid model IDs.
- 401: Invalid or missing API Key.
- 402: Insufficient Balance.
- Response includes
estimatedCreditsRequired.
- Response includes
- 429: Rate limit exceeded.
Compare the cross-provider structured-output contract, function-calling semantics, and batch API boundaries separately; these docs remain the owner of the All AI Ask gateway.
Batch 57 evidence contribution · owner: api-docs
All AI Ask unified API contract
All AI Ask’s API contract is the documented gateway boundary for authentication, request normalization, effective-model identity, response shape, errors, usage, and billing reconciliation. Use it to integrate supported models through one surface. Verified 2026-09-02; undocumented provider fields, upstream behavior, and missing usage artifacts remain explicitly conditional or Unavailable.
Verification identity: Luna / Continuous SEO Builder Batch 57 · verifiedAt 2026-09-02 · exact route owner api-docs. Qualitative demand is search-result evidence only; exact monthly volume is unavailable.
Versioned request-to-effective-model contract matrix
Scope: Owns the gateway request and response identity across API version, request schema/hash, requested/effective model, host, surface, realm, and account class.
Deterministic formula/rule: accepted = documented version + valid schema + resolved effective model; undocumented field => rejected or conditional
Evidence owner: All AI Ask API reference · verified 2026-09-02. Missing or conflicting joins fail closed.
| Frozen scenario | Request / response / model / provider / host / surface / realm / account / artifact / claim / rate / event / prompt / config / usage fields | Bounded result |
|---|---|---|
batch57-api-docs-m1-r1text request | Inputs: versioned gateway request containing a text prompt Joined fields: API version, auth scope, request schema/hash, requested/effective model, response envelope Verification: observed values are accepted only from the named source; assumptions remain labeled. | ADMITTED — contract fields complete Accept when the documented schema and effective-model receipt are present. |
batch57-api-docs-m1-r2system message | Inputs: gateway request includes a separate system message Joined fields: system field normalization, prompt hash, API version, model IDs, passed-through/normalized status Verification: observed values are accepted only from the named source; assumptions remain labeled. | CONDITIONAL — normalization receipt Document normalization before comparing provider behavior; undocumented pass-through is conditional. |
batch57-api-docs-m1-r3structured JSON | Inputs: gateway request asks for JSON under a declared schema Joined fields: schema hash, normalized request, content type, parse/validation result, effective ID Verification: observed values are accepted only from the named source; assumptions remain labeled. | GATED — schema validator required Accept only with a shared schema contract and a validator-passing response. |
batch57-api-docs-m1-r4tool call | Inputs: gateway request declares a callable tool Joined fields: tool schema/name, arguments hash, side-effect class, request/response IDs, cancellation state Verification: observed values are accepted only from the named source; assumptions remain labeled. | GATED — side-effect rule applies Retry only with idempotency protection; otherwise stop before a duplicate side effect. |
batch57-api-docs-m1-r5streaming | Inputs: gateway request uses incremental response chunks Joined fields: stream version, chunk order/hash, finish reason, cancellation, usage timing, effective ID Verification: observed values are accepted only from the named source; assumptions remain labeled. | CONDITIONAL — terminal receipt required Accept a stream receipt only when chunk order and terminal status are recorded. |
batch57-api-docs-m1-r6unsupported parameter | Inputs: request includes a field outside the documented gateway contract Joined fields: parameter name/value, API version, validation error, upstream forwarding flag, request hash Verification: observed values are accepted only from the named source; assumptions remain labeled. | REJECTED — unsupported field Reject or explicitly mark conditional; never promise direct-provider parity for an undocumented field. |
Error, retry, and side-effect safety matrix
Scope: Owns status/error shape, retryability, idempotency, cancellation, attempt cap, and side-effect rules for the gateway.
Deterministic formula/rule: retry = retryable status + idempotency where needed + attempts below cap; otherwise stop or manual
Evidence owner: All AI Ask API reference · verified 2026-09-02. Missing or conflicting joins fail closed.
| Frozen scenario | Request / response / model / provider / host / surface / realm / account / artifact / claim / rate / event / prompt / config / usage fields | Bounded result |
|---|---|---|
batch57-api-docs-m2-r1authentication failure | Inputs: request is rejected before model execution because credentials are invalid Joined fields: API key scope class, request ID, status/error code, retry-after, response hash Verification: observed values are accepted only from the named source; assumptions remain labeled. | STOP — authentication remediation Stop without retrying unchanged credentials; no model response or usage is attributed. |
batch57-api-docs-m2-r2validation error | Inputs: request fails local or gateway schema validation Joined fields: field path, schema version, request hash, status/error shape, corrected-input hash if retried Verification: observed values are accepted only from the named source; assumptions remain labeled. | STOP — request correction Fix the named field before retry; the failed attempt has no comparable model result. |
batch57-api-docs-m2-r3rate limit | Inputs: gateway or provider returns a quota/throttle response Joined fields: status, retry-after, limit bucket, account/host, idempotency key, attempt count Verification: observed values are accepted only from the named source; assumptions remain labeled. | RETRY GATED — backoff and cap Retry only under documented backoff and cap; preserve the original request identity. |
batch57-api-docs-m2-r4upstream timeout | Inputs: provider does not complete within the gateway timeout Joined fields: upstream request ID, timeout threshold, cancellation receipt, retry key, partial output hash Verification: observed values are accepted only from the named source; assumptions remain labeled. | CONDITIONAL — retry safety Retry only when idempotency and side-effect state permit; otherwise surface Unavailable. |
batch57-api-docs-m2-r5partial stream | Inputs: stream ends without a valid terminal event Joined fields: chunk hash/order, finish reason, cancellation/error, output completeness, request ID Verification: observed values are accepted only from the named source; assumptions remain labeled. | HOLD — incomplete stream Do not treat partial text as a successful response; retry or hold according to side-effect policy. |
batch57-api-docs-m2-r6write-tool interruption | Inputs: tool call may have changed external state before the response was interrupted Joined fields: tool arguments/result, idempotency key, side-effect confirmation, cancellation, rollback receipt Verification: observed values are accepted only from the named source; assumptions remain labeled. | BLOCKED — side-effect audit Stop automatic retry unless the side effect is verified idempotent or rolled back. |
Usage and billing reconciliation example set
Scope: Owns request/response/usage hashes, documented units, rate-version joins, retry attribution, and reconciled versus Unavailable billing states.
Deterministic formula/rule: reconciled = usage + exact rate version + effective model/host + invoice join; missing field => unreconciled
Evidence owner: All AI Ask billing terms · verified 2026-09-02. Missing or conflicting joins fail closed.
| Frozen scenario | Request / response / model / provider / host / surface / realm / account / artifact / claim / rate / event / prompt / config / usage fields | Bounded result |
|---|---|---|
batch57-api-docs-m3-r1simple completion | Inputs: one completion with ordinary input and output usage Joined fields: request/response/usage hashes, effective model, host, token units, rate version, invoice period Verification: observed values are accepted only from the named source; assumptions remain labeled. | RECONCILED OR UNAVAILABLE — exact joins Reconcile cost only when usage, exact rate version, identity, and invoice period all join. |
batch57-api-docs-m3-r2cached input | Inputs: completion includes a cache-hit or cache-status claim Joined fields: cache key/status, input token class, effective model/host, rate window, usage hash Verification: observed values are accepted only from the named source; assumptions remain labeled. | CONDITIONAL — cache evidence Use cached pricing only when cache status and token class are observed, not inferred from prompt reuse. |
batch57-api-docs-m3-r3reasoning usage | Inputs: response reports reasoning or hidden thinking usage separately Joined fields: reasoning field, input/output tokens, model ID, rate owner/version, usage schema Verification: observed values are accepted only from the named source; assumptions remain labeled. | UNAVAILABLE — usage semantics Keep reasoning cost Unavailable if the gateway does not document the field or rate basis. |
batch57-api-docs-m3-r4tool loop | Inputs: one logical request creates multiple tool/model turns Joined fields: attempt/turn IDs, tool arguments/results, token usage per turn, side-effect and retry state Verification: observed values are accepted only from the named source; assumptions remain labeled. | CONDITIONAL — turn ledger Reconcile at the turn level; a missing turn breaks the total rather than being averaged away. |
batch57-api-docs-m3-r5provider retry | Inputs: gateway retries an upstream attempt Joined fields: original/retry IDs, idempotency key, retry reason, usage per attempt, billed status Verification: observed values are accepted only from the named source; assumptions remain labeled. | REVIEW — retry attribution Attribute cost only to joined billed attempts and expose duplicate or missing invoice lines. |
batch57-api-docs-m3-r6missing usage | Inputs: response exists but usage fields are absent or inconsistent Joined fields: response hash, effective ID, host, raw usage object, rate version, invoice join Verification: observed values are accepted only from the named source; assumptions remain labeled. | UNAVAILABLE — usage join missing Show the response but leave cost and usage-derived comparisons Unavailable. |
Primary sources: All AI Ask API reference · All AI Ask model registry
Contextual reading: All AI Ask home · API pricing · API keys · Model roster
Owner-attributed next step: run a matched comparison at /try?source=batch57-api-docs. Historical and unavailable states remain visible until their exact source joins resolve.
