Docs

Best Practices

A working integration and a production-ready one differ in a handful of specific settings. This page covers the ones worth setting before you ship.

Always set a fallbacks array in production

A single-model request has a single point of failure. Add one or two backup models so a rate limit or provider outage degrades to a slower or different model instead of a hard failure for your users. See Model Fallbacks for the exact request shape and what triggers a retry (429, 503, or a 60-second timeout — not 4xx client errors, which would fail identically on any model). Model Fallbacks.

Set a per-key budget

Cap what each API key can spend from the dashboard, especially keys used in client-adjacent services, staging environments, or by third parties. A budget limit turns a bug or leaked key into a bounded incident instead of an open-ended one. Managing Credits.

Monitor the usage dashboard, not just your own logs

The dashboard is the source of truth for spend, per-model breakdown, and remaining rate limit headroom across every key on the account. Alert on balance thresholds and unusual per-key spend spikes there rather than reconstructing them from application logs. Open dashboard.

Set explicit client timeouts and retry counts

Configure a request timeout (30 seconds is a reasonable default for most chat completions) and a small retry count for transient network errors, independent of the fallbacks array — fallbacks handle model-level failures, client retries handle connection-level ones. Error Handling.

Pin exact model IDs

Reference models by their full aniron/ prefixed ID rather than an implicit default, and review model IDs when Aniron adds or deprecates entries in the catalog. This keeps behavior and pricing predictable across deploys. Chat Completions reference.

Rotate keys and scope them narrowly

Use one key per service or environment rather than one shared key everywhere, and rotate periodically. A narrowly scoped key limits the blast radius if it leaks, and makes it obvious which service is responsible for a given spike in the dashboard. Authentication.

Putting it together

A production-configured client, combining fallbacks, timeouts, and retries:

JavaScript
const client = new OpenAI({
  baseURL: 'https://api.aniron.ai/v1',
  apiKey: process.env.ANIRON_API_KEY,
  timeout: 30_000,   // fail fast, let your own retry/backoff take over
  maxRetries: 2,      // handled by the SDK for network-level errors
});

const completion = await client.chat.completions.create({
  model: 'aniron/llama-3.1-70b',
  fallbacks: ['aniron/llama-3.3-70b', 'aniron/claude-sonnet-4'],
  messages: [{ role: 'user', content: 'Summarize this ticket.' }],
});

Set a per-key budget before you scale

Cap spend per key from the dashboard in a couple of clicks.