Skip to main content

Examples

Practical examples to help you integrate the iNwealth API into your application.

Simple question

A single-turn question about French legislation:
For simple factual questions, leave effort and extended_thinking at their defaults to minimize token usage.

Multi-turn conversation

The API is stateless — send the full conversation history each time. Reuse the same session_id to benefit from prompt caching.
In the assistant message, include the full text that the agent returned (all concatenated delta.content values). Do not include metadata or thinking data.

Cross-border scenario

For complex cross-border questions, enable extended_thinking and use a higher effort level:

Multilingual support

The agent responds in the requested language, regardless of the user’s question language or residence:

Token-optimized integration

Best practices to minimize token consumption in production:
Key optimizations:
  1. Reuse session_id — keep the same ID across turns in a conversation. Prompt caching can reduce token costs by up to 90%.
  2. Set effort explicitly — use "low" or "medium" for straightforward questions. Reserve "high" and "max" for complex scenarios.
  3. Trim long histories — for conversations beyond 10 turns, consider sending only the last 4-6 turns to keep input tokens low.
  4. Use extended_thinking selectively — only for questions involving multiple jurisdictions or complex wealth planning.