Skip to content

airouter-dev/chatgpt-api-relay-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChatGPT API Relay Examples

OpenAI-compatible ChatGPT API relay examples for AI ROUTER.

AI ROUTER lets developers call ChatGPT-style models through an OpenAI-compatible endpoint, manage API keys, and check usage, quota, balance, and subscription status from the dashboard.

Website:

API endpoint:

https://api.ai-router.dev/v1

Examples

Runtime File
curl examples/curl/chat-completions.sh
Python examples/python/chat_completion.py
Node.js examples/nodejs/chat_completion.mjs

Quick start

Set your API key:

export AI_ROUTER_API_KEY="replace_with_your_api_key"

Call the OpenAI-compatible chat completions endpoint:

curl https://api.ai-router.dev/v1/chat/completions \
  -H "Authorization: Bearer $AI_ROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4-mini",
    "messages": [
      { "role": "user", "content": "Write one sentence about OpenAI-compatible APIs." }
    ]
  }'

Use the model name shown in your AI ROUTER dashboard. The example uses gpt-5.4-mini as a low-cost default.

Documentation

Use-case pages

Integration pages

What this repository contains

This repository contains public examples and developer documentation only. It does not contain the AI ROUTER backend, routing logic, billing logic, account scheduling, or security implementation.

AI ROUTER is not an official OpenAI service. It provides an independent relay service with OpenAI-compatible request patterns. Availability, model names, plans, and pricing are shown in the product dashboard.

Keywords

ChatGPT API relay, OpenAI-compatible API, AI API relay, LLM API, API key management, usage tracking, daily ChatGPT API plan, weekly ChatGPT API plan, developer AI API.

About

OpenAI-compatible ChatGPT API relay examples for curl, Python, Node.js, and multilingual docs

Topics

Resources

License

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors