Adding AI to Static Web Pages Without Code

KeyGroqFreeAPI · Updated 2026-11-24 · 10 Min read

Laptop displaying a chat interface
A static site with a simple chat interface powered by the keyless endpoint.

Static websites are renowned for their speed and security, yet they often lack the dynamic intelligence that modern users expect. Traditionally, adding AI features required a backend server to hide API keys and manage state. This guide shows how to bypass that complexity by calling the free, keyless endpoint directly from your browser.

The key to this approach is the free-ai model, an independent open-weight model available at https://api.keygroqfreeapi.com/v1. Because it requires no account, no API key, and no credit card, you can embed AI logic directly into HTML, JavaScript, or even browser extensions. This eliminates the need for a dedicated backend service for simple integrations.

This method is particularly useful for projects like a personal AI dashboard that aggregates news from multiple sources, or a mastermind-style assistant that runs locally in the browser. By using the keyless endpoint, you reduce infrastructure costs and simplify deployment, allowing you to focus on the user experience rather than server management.

Frequently asked questions

What is the keyless endpoint?

The keyless endpoint is a public API route that allows requests without authentication headers. It uses the base URL https://api.keygroqfreeapi.com/v1 and the model name 'free-ai'. It is designed for public, stateless access where identity is tracked only by IP address, not by user accounts.

How does it differ from standard Groq API?

Standard Groq API requires an API key and account management. The keyless endpoint requires no key, no account, and no payment method. It is not affiliated with Groq and uses a different model architecture, focusing on accessibility for hobbyists and static site developers rather than enterprise-grade SLAs.

Which is better for a static site?

For static sites, the keyless endpoint is often better because it removes the need for a backend proxy to hide keys. It allows direct browser-to-API communication. However, if you need higher quotas or specific model features, a standard API key might be preferable. See /api-key-vs-keyless for more details.

What is the model name used?

The model name is 'free-ai'. It is an independent open-weight model with approximately 35B parameters. It is fine-tuned to refuse less than commercial assistants, making it suitable for creative and coding tasks in a browser environment.

How does CORS work with this endpoint?

The endpoint has open CORS settings, meaning browsers will allow requests from any origin. This is crucial for static sites hosted on different domains. You can call the API directly from JavaScript without encountering cross-origin errors, provided you respect the rate limits.

What are the rate limits per IP?

You are limited to one request per second, with bursts of up to three requests. You can have two parallel requests. Daily limits are 10,000 requests or 10,000,000 tokens. These limits reset at 00:00 UTC. Exceeding these results in a 429 status code.

Can I use this for browser extensions?

Yes, browser extensions are ideal candidates because they run client-side code. You can use the keyless endpoint to add AI features like grammar checking or summarization directly within the extension's popup or background scripts, without needing a separate server.

How do I handle errors in the browser?

Errors return standard HTTP status codes. A 429 indicates rate limiting, and a 503 indicates the service is busy. You should implement retry logic with exponential backoff, waiting 2-5 seconds before retrying on a 503. Always check the response status before parsing the JSON.

Step by step

  1. Set Up Your Environment — Create a new HTML file and include a script tag for your JavaScript code. Ensure you have a modern browser that supports the Fetch API and ES6 features.
  2. Write the API Call Function — Create a JavaScript function that sends a POST request to the keyless endpoint. Include the messages array and set the User-Agent header. Handle the response and extract the generated text.
  3. Build the Chat Interface — Create an HTML form with an input field and a submit button. Add a div to display the chat messages. Use JavaScript to handle form submission and call the API function.
  4. Implement Streaming — Modify the API call function to enable streaming. Use a ReadableStream to parse SSE events and update the chat interface in real-time. Display the generated text as it arrives.
  5. Handle Errors and Rate Limits — Add error handling to your API call function. Implement retry logic with exponential backoff for rate limit errors. Display error messages to the user when appropriate.
  6. Test and Deploy — Test your integration thoroughly with different inputs and scenarios. Ensure it works correctly on different browsers and devices. Deploy your static site to a hosting provider and share it with users.

Understanding the Keyless Endpoint

The keyless endpoint provides a straightforward way to access AI capabilities without the overhead of authentication. By using the base URL https://api.keygroqfreeapi.com/v1, you can send POST requests to /v1/chat/completions or /v1/completions. The model name 'free-ai' is used for all requests, and no API key is required in the headers.

This endpoint is stateless, meaning each request is independent. The system tracks usage by IP address, country, and User-Agent, but does not associate requests with specific user accounts. This makes it ideal for public-facing static sites where you want to offer AI features without requiring users to sign up or log in.

No Account Required

You do not need to create an account or generate an API key. This reduces friction for users and simplifies your integration. You can start sending requests immediately from your browser console or JavaScript code.

Open CORS Policy

The endpoint allows requests from any origin, which is essential for static sites hosted on various domains. This means you can embed AI features in your site without worrying about cross-origin resource sharing restrictions.

Setting Up Your Development Environment

To integrate the keyless endpoint, you need a basic understanding of JavaScript and HTTP requests. You can use the Fetch API, which is native to modern browsers, or libraries like Axios. Ensure you set a proper User-Agent header, as the default Python urllib User-Agent may be blocked with a 403 error.

It is also important to handle errors gracefully. The API returns standard HTTP status codes, such as 429 for rate limiting and 503 for service unavailability. Implementing retry logic with exponential backoff will help ensure a smooth user experience even during peak usage times.

Using Fetch API

The Fetch API is a modern, promise-based way to make HTTP requests. It is supported in all modern browsers and is easy to use for simple integrations. You can send POST requests with JSON payloads to the chat completions endpoint.

Handling User-Agent

Always set a custom User-Agent header to avoid being blocked. The default User-Agent for some libraries may be flagged as a bot. Use a descriptive User-Agent that identifies your application, such as 'MyStaticSite/1.0'.

Direct browser to API connection
Direct connection from browser to API eliminates the need for a backend server.

Making Your First Request

To make your first request, you need to construct a JSON payload with the messages array. The messages should include a role (user or assistant) and content. The model name 'free-ai' is used in the request body, although the endpoint does not strictly require it for the keyless access.

You can send the request using the Fetch API. The response will be a JSON object containing the generated text. You can then display this text in your HTML element. This simple process allows you to add AI-driven features to your static site.

Constructing the Payload

The payload must include a messages array with at least one user message. You can also include system messages to guide the model's behavior. The model name 'free-ai' is specified in the request body.

Sending the Request

Use the Fetch API to send a POST request to the chat completions endpoint. Set the Content-Type header to application/json and include your User-Agent. Handle the response to extract the generated text.

Streaming Responses for Better UX

Streaming responses allow you to display text as it is generated, providing a more responsive user experience. The keyless endpoint supports Server-Sent Events (SSE) for streaming. You can enable streaming by setting the stream parameter to true in your request.

When streaming, the response is sent as a series of data events. Each event contains a partial response, and the stream ends with a [DONE] event. You can parse these events and update your UI in real-time, showing the user that the AI is working.

Enabling Streaming

Set the stream parameter to true in your request body. This tells the API to send responses as they are generated, rather than waiting for the full response to be ready.

Parsing SSE Events

Use a ReadableStream to parse the SSE events. Each event contains a JSON object with the partial response. Update your UI with each partial response to provide real-time feedback to the user.

Books and magnifying glass
Researching the best integration methods for static sites.

Handling Rate Limits and Errors

The keyless endpoint has strict rate limits to ensure fair usage. You are limited to one request per second, with bursts of up to three requests. If you exceed these limits, you will receive a 429 status code. Implementing retry logic with exponential backoff is essential.

Errors such as 503 indicate that the service is busy. In such cases, you should wait 2-5 seconds before retrying. Always check the response status and handle errors appropriately to provide a smooth user experience.

Implementing Retry Logic

Use exponential backoff to retry failed requests. Start with a short delay and increase it with each retry. This helps prevent overwhelming the API during peak usage times.

Displaying Error Messages

Inform the user when an error occurs. Display a message indicating that the service is temporarily unavailable or that the rate limit has been exceeded. This helps manage user expectations.

Building a Simple Chat Interface

Creating a chat interface is a common use case for integrating AI into static sites. You can build a simple chat UI using HTML, CSS, and JavaScript. The chat interface should allow users to input messages and display the AI's responses.

You can use the keyless endpoint to power the chat interface. Send user messages to the API and display the responses in the chat window. This provides a seamless experience for users who want to interact with the AI directly from your site.

Designing the UI

Create a simple chat interface with an input field and a message display area. Use CSS to style the interface and make it visually appealing. Ensure the UI is responsive and works well on different devices.

Integrating the API

Connect the chat interface to the keyless endpoint. Send user messages to the API and display the responses in the message display area. Handle streaming responses to provide real-time feedback.

Speedometer showing high speed
Fast response times are crucial for a good user experience.

Advanced Features and Optimizations

Once you have a basic chat interface working, you can add advanced features such as reasoning mode, custom system prompts, and token counting. The keyless endpoint supports reasoning mode, which allows the model to think through complex problems before generating a response.

You can also optimize your integration by caching responses or using web workers to handle API calls in the background. This helps improve performance and reduces the load on the main thread, ensuring a smooth user experience.

Using Reasoning Mode

Enable reasoning mode by setting the reasoning parameter to true. This allows the model to generate a thought process before providing the final answer. This is useful for complex queries that require multi-step reasoning.

Optimizing Performance

Use web workers to handle API calls in the background. This prevents the main thread from being blocked during long-running requests. You can also cache responses to reduce the number of API calls.

Conclusion and Next Steps

Integrating the keyless endpoint into your static site is a powerful way to add AI capabilities without the complexity of a backend. By using the free-ai model, you can provide users with intelligent features such as chat, summarization, and code generation.

To get started, explore the sibling articles on speed and architecture. See /fast-tokens-per-second to understand how to optimize your requests for speed, and check /groq-local-vs-cloud to compare local inference with API-based solutions. You can also visit /llms.txt for more technical details.

Exploring Further

Dive deeper into the API by reading the documentation and experimenting with different parameters. Try streaming responses, reasoning mode, and custom system prompts to see how they affect the user experience.

Sharing Your Work

Share your static site with the community and gather feedback. Use the 'Copy prompt' button on the home page to share your prompts with others. You can also join the community to discuss best practices and share your integrations.

Puzzle piece fitting into place
Integrating AI capabilities into existing static sites.
Try the free API

Test the keyless endpoint now: stream responses in real-time with no API key required, perfect for prototyping your next fast AI application.

Read also