lucidity.sh platform
← All posts

Synth 2.5 API in Production: Settings, Fallback, 429s and Cost per Request

A field guide for developers putting Synth 2.5 behind a real product feature: character chat, interactive fiction, game dialogue or generated copy.

Short answer: call synth-2.5-pro through the OpenAI-compatible endpoint at https://platform.lucidity.sh/v1 with temperature 0.9 and top_p 0.95, give it a system prompt that forbids writing the user's turn plus a matching stop sequence, and retry only 429 and 5xx errors. Send batch jobs straight to synth-2.5-flash, because Pro has a shared limit of 5 requests per minute. Log the response's model field, since fallback can answer with Flash. Put a moderation check in front of it: both model cards ask for one.

Pro or Flash: which one for which job

Synth 2.5 is LucidityAI's creative-writing model line. Both versions are mixture-of-experts models, so only part of the network runs for each token, which is a large part of why they are cheap to serve:

  • Synth 2.5 Pro (synth-2.5-pro) is based on Gemma 4 26B-A4B: 26B total parameters, 4B active. $0.10 per million input tokens, $0.20 per million output tokens.
  • Synth 2.5 Flash Preview (synth-2.5-flash) is based on Ling 3 Tiny: 8B total parameters, 1B active. $0.03 input, $0.10 output.

Both are previews trained with supervised fine-tuning only; the cards say RLAIF has not been applied yet. The platform routes both with a 32,000-token context window. In practice the split is simple:

  • Use Pro for anything a person reads turn by turn: companion or character chat, interactive fiction, NPC dialogue, editorial drafts. It is the default, and it falls back to Flash on its own.
  • Use Flash for volume: thousands of product descriptions, story seeds, dialogue variants for a game, A/B copy. It has no shared per-minute ceiling in the docs, and it costs 30% of Pro on input.
  • Avoid Flash for strict formats. Its card says it cannot follow deep prompts that need heavy, specific formatting. If you need JSON, ask Pro, or ask Flash for plain text and build the structure in your code.

Sampling settings that match the model cards

Both cards give the same recommendation: temperature 0.8 to 1, top_p 0.95, top_k 0 (meaning top-k is off, which is the default on most servers, so you can leave it out). The gateway forwards standard OpenAI fields such as temperature, top_p, max_tokens and stop to the model unchanged.

Start at 0.9. The Pro card notes that output "may seem predictable" even in that range, so if every reply opens the same way, vary the prompt rather than pushing temperature far above 1: rotate a few opening instructions, include a short scene-specific detail per turn, or trim repetitive older turns from the history. The cards also say creative quality is currently best in non-thinking mode.

Set max_tokens on every call. It caps cost per request, and a short ceiling such as 300 to 400 tokens keeps chat replies the length people actually read.

Stop Synth from writing your user's lines

The most common complaint about creative models in a chat product is the model taking the user's turn: writing what the player says or does next. The Synth 2.5 Flash card lists this directly: users have noted it "occasionally" writes for them. Three layers fix it, and you want all three:

  1. Say it in the system prompt, with the user's character named, and say what to do instead (stop when it is their turn).
  2. Add a stop sequence on the label your transcript uses for the user, such as "\nMaya:". Generation ends the moment the model starts that line, so you never pay for the tokens either.
  3. Trim in code as a last guard: cut the reply at the first line that starts with the user's label, and drop a trailing half sentence.

A system prompt that does the first part:

You are Captain Ilse Varga, narrating an interactive story with the user, who plays Maya.
Write only Ilse's dialogue and actions, and what the world does.
Never write Maya's dialogue, actions, thoughts or decisions.
Stop as soon as it is Maya's turn to act. Keep replies under 180 words.

And the request with the OpenAI Python SDK, pointed at the platform:

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://platform.lucidity.sh/v1",
    api_key=os.environ["LUCIDITY_API_KEY"],  # sh-live-...
)

resp = client.chat.completions.create(
    model="synth-2.5-pro",
    messages=[
        {"role": "system", "content": SYSTEM_PROMPT},
        *history,
    ],
    temperature=0.9,
    top_p=0.95,
    max_tokens=400,
    stop=["\nMaya:"],  # the user's speaker label in your transcript
)

print(resp.model)  # the model that actually answered: pro, or flash after a fallback

Clean the first few assistant turns too. Every earlier reply is sent back as context, so a reply where the model spoke for the user teaches it to do so again. Our sister site has a longer write-up on this effect in why AI roleplay repeats itself.

Fallback and the 5 requests per minute limit

Synth 2.5 Pro has a shared capacity limit of 5 requests per minute across all callers. It protects the single upstream behind the slug, so it is not a per-account quota you can raise. What happens when you hit it depends on how you call:

  • Send model: "synth-2.5-pro" and the gateway falls back to Flash automatically when Pro is over its limit, has no upstream, or fails. You get a 200 from Flash instead of an error.
  • Send models: ["synth-2.5-pro", "synth-2.5-flash"] to set the chain yourself, OpenRouter-style. With the OpenAI SDK, pass it through extra_body.
  • Send models: ["synth-2.5-pro"] if a Flash answer is worse than no answer, for example in a paid tier that promises Pro. Then a 429 comes back to you with a Retry-After header.

Three details matter in production:

  • Billing follows the model that answered. A Flash fallback is billed at Flash rates. Store resp.model next to each request so your own cost reports and quality reviews match.
  • A fallback response carries lucidity_fallback with requested, attempted and served. A first-try response has no extra field, so its presence is a clean signal to count.
  • Streaming falls back only before the first byte. Once tokens are flowing there is no invisible retry, and streamed responses never carry lucidity_fallback, so read the model field of the chunks.

The arithmetic for batch work is blunt: 5 requests per minute is 300 an hour, shared with everyone. A 100,000-item job sent to Pro would mostly be answered by Flash through fallback anyway, after a rejected Pro attempt on almost every item, and with your own traffic crowding out your interactive users' Pro slots. Send batch jobs to synth-2.5-flash directly.

Which errors to retry

StatusMeaningRetry?
400Bad request shapeNo. Fix the request; fallback never triggers on 400.
401 / 403Key missing, paused or revoked; account suspendedNo.
402Balance is emptyNo. Top up, then resend.
404Unknown model nameNo. Fix the name. In a models list, the next model answers instead.
429Rate limited, including the shared Synth 2.5 Pro limitYes. Wait for Retry-After, then back off.
500 / 502Transient gateway or upstream errorYes, with exponential backoff.
503No model in the chain has an upstream right nowNo. Alert and degrade the feature instead.

The official OpenAI SDKs already retry 429 and 5xx responses with backoff and read Retry-After. If you call the HTTP endpoint directly, this is a small wrapper that follows the table:

const BASE = 'https://platform.lucidity.sh/v1'
const RETRYABLE = new Set([429, 500, 502])

export async function complete(body, attempts = 4) {
  for (let i = 0; i < attempts; i++) {
    const res = await fetch(`${BASE}/chat/completions`, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${process.env.LUCIDITY_API_KEY}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify(body),
    })
    if (res.ok) return res.json()
    if (!RETRYABLE.has(res.status) || i === attempts - 1) {
      const err = await res.json().catch(() => ({}))
      throw new Error(`${res.status}: ${err.error?.message ?? res.statusText}`)
    }
    const retryAfter = Number(res.headers.get('retry-after'))
    const wait = retryAfter > 0 ? retryAfter * 1000 : 2 ** i * 1000 + Math.random() * 250
    await new Promise((r) => setTimeout(r, wait))
  }
}

For streaming, errors before the first byte arrive as normal JSON errors with these codes. If the client disconnects mid-stream, you are billed for the tokens already delivered, so cancel abandoned streams early. Add "stream_options": {"include_usage": true} to get a final chunk with the token counts you were billed for.

Cost per request, worked out

Billing is per token with no monthly fee: requests draw down a prepaid balance, and an empty balance returns 402. Input and output are priced separately, and input usually dominates in chat because the whole history is resent every turn. Three typical workloads at current rates:

WorkloadTokens per callProFlashAt scale (Pro vs Flash)
Chat turn with history2,000 in / 300 out$0.00026$0.00009$2.60 vs $0.90 per 10,000 turns
Long-context turn24,000 in / 400 out$0.00248$0.00076$24.80 vs $7.60 per 10,000 turns
Batch item (e.g. a product blurb)400 in / 250 out$0.00009$0.000037$9.00 vs $3.70 per 100,000 items

The long-context row is the one to watch. A chat that keeps 24,000 tokens of history costs ten times a chat that keeps 2,000, for nearly the same reply. Summarize or drop old turns once a conversation passes a few thousand tokens, and keep the system prompt tight; it is paid for on every call.

Token counts come from the upstream model when it reports them and are estimated from text length when it does not, so expect small differences against your own tokenizer counts.

Pre-launch checklist

  • One API key per environment (dev, staging, prod), so you can pause one without touching the others.
  • Temperature 0.9, top_p 0.95 and a max_tokens cap on every call.
  • System prompt plus stop sequence plus code trim for the user's turn.
  • resp.model and token usage logged per request.
  • Retries on 429 and 5xx only; 503 raises an alert instead.
  • Batch jobs on synth-2.5-flash, interactive traffic on synth-2.5-pro.
  • A moderation step on user input and model output. The Synth 2.5 cards state the model can generate harmful, illegal or NSFW content and recommend a moderation model or other safety layer in production. Our guide to writing moderation policies a guard model can enforce covers how to set one up.

Before writing any code, you can try Synth for free on Composite, LuciditySH's consumer app, or run the open weights yourself.

Synth 2.5 API FAQ

Is the LuciditySH Platform API OpenAI-compatible?

Yes. POST /v1/chat/completions, GET /v1/models and streaming over server-sent events follow the OpenAI shapes, so the official OpenAI SDKs work by setting the base URL to https://platform.lucidity.sh/v1 and using an sh-live- key from the dashboard. LuciditySH does not publish its own SDK.

What temperature should I use for Synth 2.5?

Both Synth 2.5 model cards recommend a temperature between 0.8 and 1 with top_p 0.95 and top_k 0 (disabled). Start at 0.9 and adjust in steps of 0.05 while reading real outputs. The cards also say creative quality is best in non-thinking mode in the current preview.

Why did I get synth-2.5-flash when I asked for synth-2.5-pro?

That is automatic fallback. If Synth 2.5 Pro is over its shared limit of 5 requests per minute, has no upstream, or fails, the gateway retries on Synth 2.5 Flash. The response model field names the model that answered, you are billed at that model's rates, and a lucidity_fallback field lists what was tried.

How much does Synth 2.5 cost per request?

Synth 2.5 Pro costs $0.10 per million input tokens and $0.20 per million output tokens; Synth 2.5 Flash costs $0.03 and $0.10. A chat turn with 2,000 input and 300 output tokens costs about $0.00026 on Pro and $0.00009 on Flash. There is no monthly fee.

Can I run Synth 2.5 on my own hardware?

Yes. LucidityAI publishes Synth 2.5 Pro Preview and Synth 2.5 Flash Preview weights on Hugging Face, including GGUF builds, and the cards list llama.cpp and vLLM for local use. The hosted API is the option when you want per-token billing and fallback without running GPUs.

Sources

Create an account, make a key, and the request above works as written. No monthly fee; you pay only for tokens.

Create an account