Cloudflare, Inc. is a leading web performance and security company that offers a range of services to enhance website speed, reliability, and protection. Their Cloudflare AI platform focuses on leveraging artificial intelligence and machine learning to optimize content delivery, mitigate threats, and improve user experiences. Cloudflare AI's capabilities include content-based asset creation, intelligent routing, automated threat detection, and personalized content recommendations, all aimed at making the internet faster, safer, and more efficient for businesses and users alike.
cloudflareai
const { LLMInterface } = require('llm-interface');
LLMInterface.setApiKey({
cloudflareai: [
process.env.CLOUDFLAREAI_API_KEY,
process.env.CLOUDFLAREAI_ACCOUNT_ID,
],
});
async function main() {
try {
const response = await LLMInterface.sendMessage(
'cloudflareai',
'Explain the importance of low latency LLMs.',
);
console.log(response.results);
} catch (error) {
console.error(error);
throw error;
}
}
main();
The following model aliases are provided for this provider.
default
: @cf/meta/llama-3-8b-instructlarge
: @hf/thebloke/llama-2-13b-chat-awqsmall
: @cf/tinyllama/tinyllama-1.1b-chat-v1.0agent
: @cf/meta/llama-3-8b-instruct
default
: @cf/baai/bge-base-en-v1.5large
: @cf/baai/bge-large-en-v1.5small
: @cf/baai/bge-small-en-v1.5
The following parameters can be passed through options
.
max_tokens
: The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length.temperature
: Controls the randomness of the AI's responses. A higher temperature results in more random outputs, while a lower temperature makes the output more focused and deterministic. Generally, it is recommended to alter this or top_p, but not both.
- Functions
- Embeddings
Free Tier Available: The Cloudflare AI API offers a free tier and commercial accounts. A credit card is not required for the free tier.
To get an API key, first create a Cloudflare AI account, then visit the link below.
Cloudflare AI documentation is available here.