Chilkat Examples

ChilkatHOMEAndroid™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi DLLGoJavaNode.jsObjective-CPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwiftTclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Go Examples
Web API Categories

AI
ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Apple Keychain
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Box
CAdES
CSR
CSV
Cert Store
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
Markdown
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
Regular Expressions
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
Secrets
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
X
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(Go) Multimodal Input: Image URL

See more AI Examples
Demonstrates sending a request that includes both text and an image URL for the AI to analyze.

Note: This example requires Chilkat v11.2.0 or greater.

Chilkat Go Downloads

Go Package for Windows, MacOS, Linux, Alpine Linux, Solaris

    success := false

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    ai := Ai_Ref.html">chilkat.NewAi()

    // The provider can be "openai", "google", "claude", "deepseek", "xai", or "perplexity".
    // Support for additional providers will be added in future versions of Chilkat.
    ai.SetProvider("google")

    // Use your provider's API key.
    ai.SetApiKey("MY_API_KEY")

    // Choose a model.
    ai.SetModel("gemini-2.5-flash")

    // Add both text input, and an image URL.
    // If the AI provider does not natively support image URLs, Chilkat will download the image data to memory and send the image data to the AI provider (within the "Ask" method call).
    ai.InputAddText("Describe what you see in the following image.")
    ai.InputAddImageUrl("https://www.chilkatsoft.com/images/starfish.jpg","")

    // Ask the AI for text output.
    success = ai.Ask("text")
    if success == false {
        fmt.Println(ai.LastErrorText())
        ai.DisposeAi()
        return
    }

    // Get the text response.
    sbResponse := StringBuilder_Ref.html">chilkat.NewStringBuilder()
    ai.GetOutputTextSb(sbResponse)
    fmt.Println(*sbResponse.GetAsString())

    // -------------------------------------------------------------
    // The response is in markdown format.
    // Also see Markdown to HTML Conversion Examples.
    // -------------------------------------------------------------

    // Sample output:

    // The image displays a single, vibrant **starfish** set against a plain **white background**.
    // 
    // Here's a more detailed description:
    // 
    // *   **Object:** A single starfish.
    // *   **Shape:** It has the characteristic five-pointed star shape, with each arm tapering slightly to a rounded end. The arms appear somewhat plump and substantial.
    // *   **Color:** The starfish is a beautiful **warm, golden-orange color**, with subtle variations in hue that suggest natural texture and depth. Some areas might lean a little more yellow, while others have a slightly richer, deeper orange tone.
    // *   **Texture:** Its entire surface is visibly **textured**, covered in numerous small, raised bumps or granular patterns. These details are consistent across all the arms and the central body, giving it a rough, almost sandpaper-like appearance, typical of a real starfish.
    // *   **Lighting & Depth:** The lighting on the starfish highlights these textures, creating subtle shadows in the crevices between the bumps and making the object appear distinctly three-dimensional and lifelike. The light seems to come from above, casting gentle shadows that define its form.
    // *   **Background:** The starfish is isolated against a pure white, featureless background, which makes it stand out prominently as the sole subject of the image.
    // 
    // Overall, it's a clear, well-lit photograph of a textured, orange starfish.

    ai.DisposeAi()
    sbResponse.DisposeStringBuilder()

 

© 2000-2025 Chilkat Software, Inc. All Rights Reserved.