PlatformAPI documentation

Developer docs

13. Best practices and security

Version 1.0 · 2026-10-20

← Back to the API reference

Performance

  • Stream long answers: users see content right away, and you avoid proxy timeouts.
  • Put fixed prefixes first: keep system prompts and personas unchanged and at the start of messages to hit the prefix cache and lower time to first token.
  • Set a sensible max_tokens: it controls cost and reduces the daily-quota reservation.
  • Retrieve with embeddings, then rerank: take the top 50 candidates with bge-m3, then the top 5 with bge-reranker-v2-m3 for the chat model.
  • Split long audio: keep speech-recognition segments to 10 minutes or less, and split text to speech by sentence.

Reliability

  • Have a fallback model for important flows: when the primary model returns 502 or 503, switch to a chat model that the service status shows as ready.
  • Read status.json regularly for health checks instead of testing availability with real inference requests.
  • Log each request's time (UTC), model, status code and usage, and include them when you report a problem.

Cost control

  • Test with a small amount of credit before going live, and read /dashboard/billing/subscription regularly to watch the balance.
  • Accumulate cost in your own system from each response's usage, and alert when the balance drops below a threshold.
  • Choose flux-schnell when you only need drafts, and glm-5.3-flash-uncensored when you only need fast answers.

Security and compliance

  • Keep keys on the server. Front-end applications should go through your own backend.
  • Do not put passwords, keys or unnecessary personal data in prompts.
  • glm-5.3-flash-uncensored has no built-in content filtering. Add your own content moderation to products for the general public.
  • Have generated content reviewed by a person before publishing it, and label it as AI-generated where applicable law requires.
  • For how data is handled and retained, see the Privacy Policy and the Data Retention Policy.