myapikey 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -158,6 +158,22 @@ Quick smoke test without any tool:
|
|
|
158
158
|
myapikey call gpt-4o-mini "Say hello in one sentence."
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
+
**Why two base URLs?** The gateway exposes two separate agent surfaces — `/openai/v1` and `/anthropic/v1` — each with its own `GET /models` (an OpenAI client discovers only openai-enabled models, an Anthropic client only anthropic-enabled ones). Each ecosystem's SDK appends its own paths, so the OpenAI SDK points at `…/openai/v1` (it appends `/chat/completions`, `/responses`, `/models`) and the Anthropic SDK / Claude Code points at `…/anthropic` (it appends `/v1/messages`, `/v1/models`).
|
|
162
|
+
|
|
163
|
+
**Raw HTTP** (no SDK) — hit either surface directly with the gateway API key as a `Bearer` token:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# OpenAI family
|
|
167
|
+
curl http://localhost:7800/openai/v1/chat/completions \
|
|
168
|
+
-H "Authorization: Bearer <gateway api key>" -H "Content-Type: application/json" \
|
|
169
|
+
-d '{"model":"<model>","messages":[{"role":"user","content":"hi"}]}'
|
|
170
|
+
|
|
171
|
+
# Anthropic family
|
|
172
|
+
curl http://localhost:7800/anthropic/v1/messages \
|
|
173
|
+
-H "Authorization: Bearer <gateway api key>" -H "Content-Type: application/json" \
|
|
174
|
+
-d '{"model":"<model>","max_tokens":16,"messages":[{"role":"user","content":"hi"}]}'
|
|
175
|
+
```
|
|
176
|
+
|
|
161
177
|
Whichever endpoint you point a tool at, the gateway forwards in that format and never translates — so make sure each model you call is backed by at least one source on the matching slot ([see below](#how-routing-works)).
|
|
162
178
|
|
|
163
179
|
---
|
package/README.zh-CN.md
CHANGED
|
@@ -158,6 +158,22 @@ export ANTHROPIC_API_KEY=<网关 API Key>
|
|
|
158
158
|
myapikey call gpt-4o-mini "用一句话打个招呼。"
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
+
**为什么有两个 Base URL?** 网关暴露了两个互相独立的 agent 面——`/openai/v1` 和 `/anthropic/v1`,各自带自己的 `GET /models`(OpenAI 客户端只发现 openai 槽位启用的模型,Anthropic 客户端只发现 anthropic 槽位启用的模型)。两套生态的 SDK 各自拼接自己的路径:OpenAI SDK 指向 `…/openai/v1`(它自己补 `/chat/completions`、`/responses`、`/models`),Anthropic SDK / Claude Code 指向 `…/anthropic`(它自己补 `/v1/messages`、`/v1/models`)。
|
|
162
|
+
|
|
163
|
+
**直接用 HTTP**(不走 SDK)——带上网关 API Key(`Bearer`)直接打这两个面之一:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# OpenAI 系
|
|
167
|
+
curl http://localhost:7800/openai/v1/chat/completions \
|
|
168
|
+
-H "Authorization: Bearer <网关 API Key>" -H "Content-Type: application/json" \
|
|
169
|
+
-d '{"model":"<模型名>","messages":[{"role":"user","content":"hi"}]}'
|
|
170
|
+
|
|
171
|
+
# Anthropic 系
|
|
172
|
+
curl http://localhost:7800/anthropic/v1/messages \
|
|
173
|
+
-H "Authorization: Bearer <网关 API Key>" -H "Content-Type: application/json" \
|
|
174
|
+
-d '{"model":"<模型名>","max_tokens":16,"messages":[{"role":"user","content":"hi"}]}'
|
|
175
|
+
```
|
|
176
|
+
|
|
161
177
|
不管你把工具指向哪个端点,网关都按那个格式转发、绝不翻译——所以确保你调用的每个模型,在对应的槽位上至少有一个来源在服务它([见下文](#路由是怎么工作的))。
|
|
162
178
|
|
|
163
179
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myapikey",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Personal LLM API gateway & proxy — one address + one API key for all your models. Forwards OpenAI & Anthropic calls to your backends with failover and a circuit breaker. Pure passthrough, no format translation. Self-hosted (CLI + web UI).",
|
|
6
6
|
"keywords": [
|