Invoking Applications with HTTP

After you get an access token, you can invoke an OCI Generative AI application. This page describes how to use the access token with HTTP to invoke the client. You can use any http client library or the curl command.

In the following example:

  • The container image exposes an http endpoint POST /chat, therefore you concatenate /chat to the application URL.
  • The OAuth token is added to the Authorization header.
  • The body is in JSON which matches the payload format that you define in the container code.

Example code:

$ curl -X POST 
'https://application.generativeai.ap-osaka-1.oci.oraclecloud.com
/20251112/hostedApplications/<your_application_ocid>/actions/invoke/chat' \
 

The previous example code is followed by this code:


  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {access_token}' \
  --body '{
  "thread_id": "test-111",
  "message": "What's the weather in Seattle?"
}'