![]()  | 
  
Chilkat  HOME  Android™  AutoIt  C  C#  C++  Chilkat2-Python  CkPython  Classic ASP  DataFlex  Delphi DLL  Go  Java  Node.js  Objective-C  PHP Extension  Perl  PowerBuilder  PowerShell  PureBasic  Ruby  SQL Server  Swift  Tcl  Unicode C  Unicode C++  VB.NET  VBScript  Visual Basic 6.0  Visual FoxPro  Xojo Plugin
 
      (SQL Server) List AI ModelsSee more AI ExamplesReturns a sorted list of AI models available to your account for the specified AI provider, such asGPT-4o and GPT-5.Note: This example requires Chilkat v11.2.0 or greater. 
 -- Important: See this note about string length limitations for strings returned by sp_OAMethod calls. -- CREATE PROCEDURE ChilkatSample AS BEGIN DECLARE @hr int -- Important: Do not use nvarchar(max). See the warning about using nvarchar(max). DECLARE @sTmp0 nvarchar(4000) DECLARE @success int SELECT @success = 0 -- This example assumes the Chilkat API to have been previously unlocked. -- See Global Unlock Sample for sample code. DECLARE @ai int EXEC @hr = sp_OACreate 'Chilkat.Ai', @ai OUT IF @hr <> 0 BEGIN PRINT 'Failed to create ActiveX component' RETURN END -- The provider can be "openai", "google", "claude", "deepseek", "xai", or "perplexity". -- Support for additional providers will be added in future versions of Chilkat. EXEC sp_OASetProperty @ai, 'Provider', 'openai' -- Use your provider's API key. EXEC sp_OASetProperty @ai, 'ApiKey', 'MY_API_KEY' -- Note: Chilkat currently uses a hard-coded list of available models for Perplexity and XAi (Grok) -- because these AI providers do not offer an API endpoint to list models. -- If they introduce such a REST API call in the future, Chilkat will update to incorporate it in a later version. DECLARE @st int EXEC @hr = sp_OACreate 'Chilkat.StringTable', @st OUT EXEC sp_OAMethod @ai, 'GetModels', @success OUT, @st IF @success = 0 BEGIN EXEC sp_OAGetProperty @ai, 'LastErrorText', @sTmp0 OUT PRINT @sTmp0 EXEC @hr = sp_OADestroy @ai EXEC @hr = sp_OADestroy @st RETURN END DECLARE @count int EXEC sp_OAGetProperty @st, 'Count', @count OUT DECLARE @i int SELECT @i = 0 WHILE @i < @count BEGIN EXEC sp_OAMethod @st, 'StringAt', @sTmp0 OUT, @i PRINT @sTmp0 SELECT @i = @i + 1 END -- Sample output: -- babbage-002 -- chatgpt-4o-latest -- codex-mini-latest -- dall-e-2 -- dall-e-3 -- davinci-002 -- gpt-3.5-turbo -- gpt-3.5-turbo-0125 -- gpt-3.5-turbo-1106 -- gpt-3.5-turbo-16k -- gpt-3.5-turbo-instruct -- gpt-3.5-turbo-instruct-0914 -- gpt-4 -- gpt-4-0125-preview -- gpt-4-0613 -- gpt-4-1106-preview -- gpt-4-turbo -- gpt-4-turbo-2024-04-09 -- gpt-4-turbo-preview -- gpt-4.1 -- gpt-4.1-2025-04-14 -- gpt-4.1-mini -- gpt-4.1-mini-2025-04-14 -- gpt-4.1-nano -- gpt-4.1-nano-2025-04-14 -- gpt-4o -- gpt-4o-2024-05-13 -- gpt-4o-2024-08-06 -- gpt-4o-2024-11-20 -- gpt-4o-audio-preview -- gpt-4o-audio-preview-2024-10-01 -- gpt-4o-audio-preview-2024-12-17 -- gpt-4o-audio-preview-2025-06-03 -- gpt-4o-mini -- gpt-4o-mini-2024-07-18 -- gpt-4o-mini-audio-preview -- gpt-4o-mini-audio-preview-2024-12-17 -- gpt-4o-mini-realtime-preview -- gpt-4o-mini-realtime-preview-2024-12-17 -- gpt-4o-mini-search-preview -- gpt-4o-mini-search-preview-2025-03-11 -- gpt-4o-mini-transcribe -- gpt-4o-mini-tts -- gpt-4o-realtime-preview -- gpt-4o-realtime-preview-2024-10-01 -- gpt-4o-realtime-preview-2024-12-17 -- gpt-4o-realtime-preview-2025-06-03 -- gpt-4o-search-preview -- gpt-4o-search-preview-2025-03-11 -- gpt-4o-transcribe -- gpt-5 -- gpt-5-2025-08-07 -- gpt-5-chat-latest -- gpt-5-codex -- gpt-5-mini -- gpt-5-mini-2025-08-07 -- gpt-5-nano -- gpt-5-nano-2025-08-07 -- gpt-audio -- gpt-audio-2025-08-28 -- gpt-image-1 -- gpt-realtime -- gpt-realtime-2025-08-28 -- o1 -- o1-2024-12-17 -- o1-mini -- o1-mini-2024-09-12 -- o1-pro -- o1-pro-2025-03-19 -- o3 -- o3-2025-04-16 -- o3-mini -- o3-mini-2025-01-31 -- o4-mini -- o4-mini-2025-04-16 -- o4-mini-deep-research -- o4-mini-deep-research-2025-06-26 -- omni-moderation-2024-09-26 -- omni-moderation-latest -- text-embedding-3-large -- text-embedding-3-small -- text-embedding-3-small-okan-test -- text-embedding-ada-002 -- tts-1 -- tts-1-1106 -- tts-1-hd -- tts-1-hd-1106 -- whisper-1 EXEC @hr = sp_OADestroy @ai EXEC @hr = sp_OADestroy @st END GO  | 
  ||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.