TypeScript
Because __weflayr_tags is not part of provider SDK types, use the flayred helper to attach tags without casting:
import { weflayr_instrument, flayred } from 'weflayr';
const response = await client.chat.completions.create(flayred({
model: 'gpt-4o-mini',
messages: [...],
__weflayr_tags: {
feature: 'support-bot',
customer_id: 'cust_abc123',
provider: 'openai',
},
}));
flayred<T>(options: T & { __weflayr_tags? }): T — TypeScript sees the return type as T, so it is fully compatible with the provider SDK’s expected parameter type. At runtime it is an identity function.