Using the endpoint

9gate uses the OpenAI request and response format for /v1/chat/completions. Authenticate with your virtual key.

Connection

Base URL
https://llm.forgestack.my.id/v1
Authentication header
Authorization: Bearer $NINEGATE_API_KEY

Send your first request

Store the key in the NINEGATE_API_KEY environment variable on your server. Pick a model from the model catalog.

import OpenAI from "openai";const client = new OpenAI({  baseURL: "https://llm.forgestack.my.id/v1",  apiKey: process.env.NINEGATE_API_KEY,});const response = await client.chat.completions.create({  model: "9gate-lite",  messages: [{ role: "user", content: "Hello, 9gate!" }],});console.log(response.choices[0].message.content);

The SDK examples use the openai package. Install it with npm install openai or pip install openai. Visitors can read a key that sits in the browser, so send requests through your app's server.

Use it with your agent

Pick the guide for your tool. The examples use 9gate-lite; replace it with a model your key is allowed to use.

OpenCode

Add a 9gate provider to opencode.json. Store the key in the NINEGATE_API_KEY environment variable, then choose 9gate/9gate-lite through /models.

{  "$schema": "https://opencode.ai/config.json",  "provider": {    "9gate": {      "npm": "@ai-sdk/openai-compatible",      "name": "9gate",      "options": {        "baseURL": "https://llm.forgestack.my.id/v1",        "apiKey": "{env:NINEGATE_API_KEY}"      },      "models": {        "9gate-lite": {          "name": "9gate Lite"        }      }    }  }}
Official OpenCode guide

Hermes

Run hermes model and choose Custom endpoint to enter the URL, key, and model. Alternatively, add the settings below to ~/.hermes/config.yaml and export NINEGATE_API_KEY.

model:  provider: custom  base_url: https://llm.forgestack.my.id/v1  default: 9gate-lite  key_env: NINEGATE_API_KEY
Official Hermes guide

Pi

Add the provider to models.json in the Pi agent directory. apiKey reads the NINEGATE_API_KEY environment variable. Open /model to reload the configuration and choose 9gate-lite.

{  "providers": {    "9gate": {      "baseUrl": "https://llm.forgestack.my.id/v1",      "api": "openai-completions",      "apiKey": "$NINEGATE_API_KEY",      "models": [        {          "id": "9gate-lite"        }      ]    }  }}
Official Pi guide

omp

Save the settings in ~/.omp/agent/models.yml. Export NINEGATE_API_KEY, run omp models 9gate to check the configuration, then choose a model through /model.

providers:  9gate:    baseUrl: https://llm.forgestack.my.id/v1    api: openai-completions    apiKey: NINEGATE_API_KEY    models:      - id: 9gate-lite
Official omp guide

ChatGPT

These docs have not verified the steps for changing the base URL of ChatGPT conversations. Do not paste your key into a chat. For apps that use the OpenAI request format, use the SDK or cURL examples above.

Official ChatGPT guide

Don't have a key yet?

Contact the Forgestack team to choose a plan and request a key.

Request an API key