mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-16 03:42:21 +03:00
Validado em lote numa worktree combinada com os 9 PRs desta leva sobre o tip de `release/v3.8.51`: `typecheck:core` limpo, `check:provider-consistency` OK (273 entradas REGISTRY, **356** providers canônicos), `check-docs-counts-sync` exit 0 e **300/300** nos testes que a leva toca. O crescimento de arquivo que os PRs empilham uns sobre os outros foi rebaselinado num único registro datado (`_rebaseline_2026_09_03_houminxi_batch`), com a decomposição por arquivo: `providers/page.tsx` +18 (import CSV do #12504 + busca do #12495 no mesmo painel), `accountFallback.ts` +6 (o #12566 sobre o rebaseline que o #12590 já registrou — os dois tocam `checkFallbackError`) e `chatCore.ts` +3 (invalidez de cache de quota no 429 do #12325). As violações restantes (`codex.ts`, `stream.ts`) foram medidas também no tip puro e são drift da base, não desta leva.
44 lines
1.9 KiB
Markdown
44 lines
1.9 KiB
Markdown
---
|
||
title: "Import providers from a CSV or JSON file"
|
||
---
|
||
|
||
# Import providers from a CSV or JSON file
|
||
|
||
Dashboard → Providers → **Import from file** creates API-key connections from a CSV or JSON list. Each row can target a different provider. Partial failure is the contract: valid rows still import when others fail, and the modal lists why the failed rows were rejected.
|
||
|
||
This import does **not** create new OpenAI/Anthropic-compatible endpoint nodes. Create those first (Dashboard → Providers → Add OpenAI-Compatible, or `omniroute nodes add`), then import rows whose `provider` column is that node's id. A per-row `baseUrl` can still override the node's URL.
|
||
|
||
## CSV (positional)
|
||
|
||
Column names are cosmetic. The parser splits each row and destructures by index:
|
||
|
||
| Index | Field | Required | Notes |
|
||
| ----- | ----- | -------- | ----- |
|
||
| 0 | `provider` | yes | Existing managed provider id (`openai`, `anthropic`, …) **or** an already-registered OpenAI/Anthropic-compatible **node** id |
|
||
| 1 | `name` | yes | Connection display name |
|
||
| 2 | `apiKey` | yes | API key |
|
||
| 3 | `baseUrl` | no | Per-row URL override |
|
||
| 4 | `priority` | no | Integer 1–100 |
|
||
|
||
A first line whose first column is the literal word `provider` (any case) is skipped as a header. Blank lines and `#` comments are skipped.
|
||
|
||
Download a starter file from the import modal (**Download CSV template**). Example:
|
||
|
||
```csv
|
||
# OmniRoute provider import (positional columns)
|
||
provider,name,apiKey,baseUrl,priority
|
||
openai,Prod OpenAI,sk-your-openai-key,,1
|
||
```
|
||
|
||
A made-up id such as `openai-compatible-chat-001` is not a node. The API returns `Unknown or unsupported provider` for that row; the modal shows it next to the row name.
|
||
|
||
## JSON
|
||
|
||
A JSON array of objects with the same fields (`provider`, `name`, `apiKey`, `baseUrl?`, `priority?`). Unlike CSV, JSON keys are named.
|
||
|
||
```json
|
||
[
|
||
{ "provider": "openai", "name": "Prod OpenAI", "apiKey": "sk-your-openai-key", "priority": 1 }
|
||
]
|
||
```
|