Expand API access docs: curl, OpenAI SDK, pi.dev, and generic OpenAI-compatible configs
This commit is contained in:
1 parent
e4297bb922
commit
0e605de7d5
1 file changed
+59
-6
@@ -72,20 +72,73 @@ The gateway currently exposes three models (all served through Tinfoil's TEE-pro
|
||||
|
||||
Members can use the co-op's models programmatically through an OpenAI-compatible API:
|
||||
|
||||
- **Endpoint:** `https://gateway.inference.coop/v1`
|
||||
- **Auth:** a bearer API key (created in the [Member Dashboard](https://dashboard.inference.coop))
|
||||
- **Format:** standard OpenAI chat completions (`POST /v1/chat/completions`)
|
||||
- **Endpoint (base URL):** `https://gateway.inference.coop/v1`
|
||||
- **Auth:** a bearer API key (create one in the [Member Dashboard](https://dashboard.inference.coop))
|
||||
- **Format:** OpenAI chat completions — `POST https://gateway.inference.coop/v1/chat/completions`
|
||||
- **Models:** `deepseek-v4-1-flash` (default), `gpt-oss-120b`, `glm-5-3-flash`
|
||||
|
||||
Example:
|
||||
API usage draws from the **same monthly balance as chat** — there is no separate quota. The gateway is publicly reachable (member keys authenticate it), but its admin UI and API documentation are disabled; admin access is via the internal dashboard or the gateway's admin endpoints.
|
||||
|
||||
#### Plain `curl`
|
||||
|
||||
```bash
|
||||
curl https://gateway.inference.coop/v1/chat/completions \
|
||||
-H "Authorization: Bearer sk-..." \
|
||||
-H "Authorization: Bearer sk-your-key" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"model": "deepseek-v4-1-flash", "messages": [{"role": "user", "content": "Hello"}]}'
|
||||
```
|
||||
|
||||
API usage draws from the **same monthly balance as chat** — there is no separate quota. The gateway is publicly reachable (member keys authenticate it), but its admin UI and API documentation are disabled; admin access is via the internal dashboard or the gateway's admin endpoints.
|
||||
#### OpenAI SDK (Python, Node, etc.)
|
||||
|
||||
Point the SDK at our base URL and use the member key:
|
||||
|
||||
```python
|
||||
from openai import OpenAI
|
||||
|
||||
client = OpenAI(
|
||||
base_url="https://gateway.inference.coop/v1",
|
||||
api_key="sk-your-key",
|
||||
)
|
||||
resp = client.chat.completions.create(
|
||||
model="deepseek-v4-1-flash",
|
||||
messages=[{"role": "user", "content": "Hello"}],
|
||||
)
|
||||
```
|
||||
|
||||
Any OpenAI-compatible client works the same way: set the base URL to `https://gateway.inference.coop/v1` and the API key to your member key.
|
||||
|
||||
#### pi.dev (coding agent)
|
||||
|
||||
pi.dev's `api` field selects the protocol. Use `openai-completions` (our gateway is an OpenAI-compatible chat-completions server), set `baseUrl` to the full `/v1` path, and `apiKey` to your member key:
|
||||
|
||||
```json
|
||||
{
|
||||
"providers": {
|
||||
"inference-coop": {
|
||||
"baseUrl": "https://gateway.inference.coop/v1",
|
||||
"api": "openai-completions",
|
||||
"apiKey": "sk-your-key",
|
||||
"models": [
|
||||
{ "id": "deepseek-v4-1-flash" },
|
||||
{ "id": "gpt-oss-120b" },
|
||||
{ "id": "glm-5-3-flash" }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Note: pi.dev appends `/chat/completions` to `baseUrl` itself, so include the trailing `/v1` and do **not** add `/chat/completions`.
|
||||
|
||||
#### Other OpenAI-compatible tools (Ollama-style, LibreChat, etc.)
|
||||
|
||||
The general pattern is the same across tools that speak the OpenAI API:
|
||||
|
||||
- **Base URL / endpoint:** `https://gateway.inference.coop/v1`
|
||||
- **API type / protocol:** "OpenAI compatible" or `openai-completions` (not "Ollama", "Anthropic", or "Responses")
|
||||
- **API key:** your member key (the `sk-…` string)
|
||||
|
||||
If a tool's docs show an Ollama example with `baseUrl: http://localhost:11434/v1` and `api: "openai-completions"`, substitute our base URL and your member key for `apiKey` — the `api` value stays the same.
|
||||
|
||||
### Privacy
|
||||
|
||||
|
||||
Reference in new issue
Block a user