Implement Free HTTPS Outcalls to Frontier AI Models

This proposal represents a hopeful initiative and my final attempt at implementing AI agents in a verifiable, “on-chain” manner. The current cost is prohibitively high due to the substantial number of calls required to support multi-agent workflows.

Specifically, the goal is to enable free HTTP outcalls to APIs such as OpenAI or Anthropic, which would significantly reduce costs and unlock new possibilities for integrating advanced AI capabilities.

Additionally, extending the outcalls timeout (as detailed here) would significantly enhance feasibility.

I believe this approach has the potential to unlock agents on-chain on the Internet Computer, positioning the IC as the premier “AI blockchain”.

I also recognize the potential overlap with the Caffeine AI efforts or the possibility of alternative solutions. If a better approach exists, I would greatly appreciate your guidance in order to adapt our roadmap.

Why not use Chainlink, Band Protocol, API3, or Pyth Network as oracles instead of IC’s HTTP outcalls to connect your AI agents with OpenAI/Claude APIs? Do you think this would be a viable solution?

1 Like

Our dapp is on the IC, so our goal is to figure out how to run AI agents using the IC, and this seems to be the easiest way. Running the whole thing on-chain is not an option, so we are happy to only be able to verify everything up to OpenAI or Anthropic servers.

I would hope that Dfinity is cooking something with Caffeine AI, as they are probably using the same approach. Ideally, we would have an open API before having a dapp from Dfinity using it.

The other option, and given the lack of response, I am leaning toward this, is to make the main app off-chain using a web2 stack and only put some artifacts on the IC for verification. It should be better than using other blockchain stack + web2 + IC, as you mentioned.

Hi folks,

I believe we can increase the deadline limit but we need to run some analysis to make sure don’t impact in negative way the throughput of the feature.

Can I also ask you to provide us with the potential API documentation that you want to use ?

Rosti

1 Like

Nice to hear! Even increasing it to 1 minute would provide us with much more than double the number of successful queries.

Our goal is to call the latest AI models from OpenAI and Anthropic.
See OpenAI API Documentation and Anthropic API Documentation for reference.

For example, here is a call to OpenAI’s GPT-4 model:

curl https://api.openai.com/v1/chat/completions
-H "Content-Type: application/json"
-H "Authorization: Bearer $OPENAI_API_KEY"
-d '{
        "model": "gpt-4o",
        "messages": [
            {"role": "user", "content": "write a haiku about ai"}
        ]
    }'

Similarly, here’s a call to Anthropic’s claude-3-5-sonnet-latest model:

curl https://api.anthropic.com/v1/messages \
     --header "x-api-key: $ANTHROPIC_API_KEY" \
     --header "anthropic-version: 2023-06-01" \
     --header "content-type: application/json" \
     --data \
'{
    "model": "claude-3-5-sonnet-latest",
    "max_tokens": 1024,
    "messages": [
        {"role": "user", "content": "Hello, world"}
    ]
}'

Timeouts often depend on the size of the prompt/messages being sent.