> ## Documentation Index
> Fetch the complete documentation index at: https://arka-agent-mintlify-f21cea86.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 最大化免费 AI 额度

> 配置 Gemini、Groq、OpenRouter 和 Ollama，以零或低成本使用 Arka —— 含故障转移、密钥轮换和节省 token 的路由。

刚接触 Arka？从这里开始，充分利用免费 LLM 配额，并在可能时使用本地模型。

## 自然语言

```bash theme={null}
arka how to get free ai credits
arka maximize free credits
arka free tier setup
arka how to use arka without paying
arka learn free ai providers
```

## CLI

```bash theme={null}
arka free_credits
```

显示已配置的提供商、推荐的 `.env` 设置以及验证步骤。

## 免费提供商（推荐组合）

| 提供商 | 成本 | 获取密钥 |
| - | - | - |
| **Gemini** | 免费层 | [Google AI Studio](https://aistudio.google.com/apikey) |
| **Groq** | 免费层 | [Groq Console](https://console.groq.com/keys) |
| **OpenRouter** | 免费 + 付费模型 | [OpenRouter](https://openrouter.ai/keys) |
| **Ollama** | 本地 — 无 API 费用 | [ollama.com](https://ollama.com) + `ollama pull llama3.2:1b` |

Arka 默认故障转移链：**Gemini Flash → Groq Llama → Ollama**，然后才是其他已配置的提供商。

## 分步设置

### 1. 将密钥写入 `.env`

编辑 `~/.config/arka/.env`（由 `arka setup` 创建）：

```env theme={null}
GEMINI_API_KEY=your_key
GROQ_API_KEY=your_key
OPENROUTER_API_KEY=your_key
```

至少使用一个云端密钥，或在本地运行 Ollama 以实现零 API 成本。

### 2. 用备用密钥延长配额

```env theme={null}
GEMINI_API_KEYS=key2,key3
GROQ_API_KEY_2=backup_key
API_KEY_ROTATION=1
```

遇到 429 限流时，Arka 会在切换提供商之前轮换密钥。

### 3. 节省路由 token

```env theme={null}
ROUTE_MODE=symbolic
LLM_AUTO_FALLBACK=1
```

`symbolic` 在本地运行大多数技能；LLM 仅分类技能名称，而非完整技能手册。

### 4. 按硬件选择模型

```bash theme={null}
arka select best model for my pc
arka select_model --apply
```

或设置首选快速模型：

```env theme={null}
AI_PREFERRED_PROVIDER=gemini
AI_PREFERRED_MODEL=gemini-2.0-flash
```

### 5. 验证

```bash theme={null}
arka setup
arka doctor
arka ai-models
```

## Context7 与 MCP

**Context7**（`CONTEXT7_API_KEY`）为可选项。它用于库文档 MCP 查询，而非聊天 LLM 调用。需要实时文档搜索时再配置即可。

## 相关内容

* [LLM 概念](/cn/concepts/llm) — 提供商与故障转移
* [选择模型](/cn/guides/select-model) — 硬件感知推荐
* [运行模式](/guides/operation-modes) — `ROUTE_MODE` 参考


## Related topics

- [查找免费模型](/cn/guides/free-models.md)
- [配置、环境变量与 API 密钥设置](/cn/reference/configuration.md)
- [2026 年 9 月 28 日当周](/cn/changelog/2026-09-28.md)
- [多提供商故障切换的 LLM 编排](/cn/concepts/llm.md)
- [2026 年 8 月 17 日当周](/cn/changelog/2026-08-17.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.