# How FreeLLMAPI Implements AI Horde Keyless Authentication

> Discover how FreeLLMAPI implements AI Horde keyless authentication by accepting no-key for anonymous routing and bypassing API keys, normalizing payloads for OpenAI compatibility.

- Repository: [Tashfeen/freellmapi](https://github.com/tashfeenahmed/freellmapi)
- Tags: how-to-guide
- Published: 2026-08-27

---

**FreeLLMAPI handles AI Horde's keyless authentication by accepting the sentinel value `"no-key"` which triggers anonymous routing through AI Horde's lowest-priority queue (`0000000000`), bypassing API key requirements while normalizing request payloads to match the provider's OpenAI-compatible proxy.**

FreeLLMAPI provides a unified interface for multiple language model providers, including the community-powered AI Horde. When integrating AI Horde's anonymous inference capability, the system must handle authentication differently than traditional API-key-based services. As defined in [`shared/types.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/shared/types.ts) lines 194-198, AI Horde operates as a free, community-powered inference option, requiring no API key for basic access. This article examines how the tashfeenahmed/freellmapi repository routes keyless requests through AI Horde's shared priority queue while maintaining compatibility with standard OpenAI-style interfaces.

## The "no-key" Sentinel Pattern in AIHordeProvider

At the core of the implementation is the **`AIHordeProvider`** class located in [`server/src/providers/aihorde.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/server/src/providers/aihorde.ts). When a user omits an API key or explicitly passes the string `"no-key"`, the provider stores this sentinel value to flag the request as anonymous.

### Anonymous Request Detection

According to the source code at **line 75**, the provider initializes with the `"no-key"` sentinel when no valid API key is supplied. This triggers the downstream logic to use AI Horde's built-in anonymous account system rather than authenticating against a specific user key.

## Queue Priority Management for Anonymous Users

AI Horde assigns the priority identifier **`0000000000`** to all anonymous requests, placing them in a shared queue with the lowest priority level.

### Shared Queue Handling in Provider Quota Service

The [`provider-quota.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/provider-quota.ts) service explicitly accounts for this behavior. At **line 130**, the code comments indicate that anonymous requests "share one queue priority (the 0000000000 key)". This ensures that keyless authentication does not bypass rate limiting but instead routes requests through AI Horde's community queue where processing occurs after authenticated users.

## Payload Normalization for Compatibility

AI Horde's OpenAI-compatible proxy differs from the standard OpenAI API in several critical ways, including error response shapes and usage metrics.

### Request and Response Rewriting

As implemented in [`server/src/providers/aihorde.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/server/src/providers/aihorde.ts) around **line 125**, the provider rewrites request payloads and responses to bridge these gaps. The normalization handles AI Horde's **`{detail}`** error format and translates the provider's native *kudos* system into token counts that FreeLLMAPI's internal schema expects. This prevents HTTP 422 errors and ensures usage statistics record correctly despite the keyless authentication flow.

## Frontend Integration and User Interface

The client-side implementation marks AI Horde as explicitly keyless to inform users that no secret is required.

In [`client/src/components/keys/shared.tsx`](https://github.com/tashfeenahmed/freellmapi/blob/main/client/src/components/keys/shared.tsx) at **line 67**, the key selector component sets **`keyless: true`** for the AI Horde provider. This boolean flag drives the UI to hide API key input fields when users select AI Horde, reinforcing that the `"no-key"` sentinel will be used automatically.

## Practical Implementation Examples

To invoke AI Horde without an API key, developers pass the `"no-key"` string or simply omit the key parameter entirely.

```typescript
// Direct provider usage with sentinel
import { AIHordeProvider } from 'freellmapi/server/src/providers/aihorde.js';

const provider = new AIHordeProvider();

// 'no-key' triggers anonymous routing through priority queue 0000000000
const response = await provider.chatCompletion(
  'no-key',
  [{ role: 'user', content: 'Explain quantum computing' }],
  'gpt-3.5-turbo'
);

console.log(response.choices[0].message.content);

```

```typescript
// High-level client omitting key parameter
import { FreeLLMClient } from 'freellmapi-client';

const client = new FreeLLMClient({
  provider: 'aihorde',
  // Key omitted - client passes 'no-key' internally
});

const result = await client.chat({
  model: 'gpt-3.5-turbo',
  messages: [{ role: 'user', content: 'Hello world' }]
});

```

## Summary

- FreeLLMAPI uses the `"no-key"` sentinel string in [`server/src/providers/aihorde.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/server/src/providers/aihorde.ts) to flag anonymous AI Horde requests at line 75.
- Anonymous requests route through priority queue `0000000000`, handled by the quota service in [`server/src/services/provider-quota.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/server/src/services/provider-quota.ts) at line 130.
- The provider normalizes AI Horde's non-standard payloads—including `{detail}` errors and *kudos* metrics—around line 125 to maintain OpenAI compatibility.
- The frontend marks AI Horde as `keyless: true` in [`client/src/components/keys/shared.tsx`](https://github.com/tashfeenahmed/freellmapi/blob/main/client/src/components/keys/shared.tsx) at line 67, removing API key input requirements from the UI.

## Frequently Asked Questions

### What happens if I provide a real API key to AI Horde through FreeLLMAPI?

If you provide a valid AI Horde API key instead of `"no-key"`, FreeLLMAPI routes the request through your personal queue with higher priority than the anonymous `0000000000` queue, according to the provider implementation in [`server/src/providers/aihorde.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/server/src/providers/aihorde.ts).

### Does using keyless authentication affect response quality or speed?

No, the model quality remains identical, but requests using `"no-key"` enter AI Horde's lowest priority queue. As noted in [`server/src/services/provider-quota.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/server/src/services/provider-quota.ts) at line 130, these anonymous requests share one queue priority, meaning they process after authenticated users during high-traffic periods.

### Is the "no-key" sentinel value configurable?

No, the string `"no-key"` is hardcoded as the authentication sentinel in the `AIHordeProvider` class. Changing this value would require modifying the source code at [`server/src/providers/aihorde.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/server/src/providers/aihorde.ts) and corresponding checks in the quota service.

### How does FreeLLMAPI handle AI Horde's "kudos" system with keyless auth?

The provider normalizes kudos into standard token counts during the response rewriting phase around line 125 in [`server/src/providers/aihorde.ts`](https://github.com/tashfeenahmed/freellmapi/blob/main/server/src/providers/aihorde.ts). This abstraction allows FreeLLMAPI to track usage consistently across all providers regardless of whether the request uses keyless authentication or a personal API key.