KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Testing 4DAIKit API Connection
PRODUCT: 4D | VERSION: 20 R | PLATFORM: Mac & Win
Published On: October 13, 2025
Before implementing 4DAIKit features, verifying the API key configuration with a simple connection test helps identify issues early.

Example :

var $result : Object
$result := cs.AIKit.OpenAI.new("AI_API_KEY").models.list()

If ($result.success)
   ALERT("✓ Connected! Models available: " + String($result.models.length))
Else
   ALERT("✗ Connection failed. Check your API key.")
End if


models.list() is the best lightweight endpoint for testing, as it confirms authentication using minimal tokens.