# rNet AI Full Technical Documentation for LLM Agents > rNet AI is a universal AI credit wallet (BYOAC — Bring Your Own AI Credit) and network routing gateway. > End-users maintain one credit balance across all connected AI applications. Developers integrate rNet via SDK or OAuth API to eliminate token liability and billing complexity. --- ## Executive Summary - **Product Name**: rNet AI - **Core Concept**: Bring Your Own AI Credits (BYOAC) & OAuth-based AI API Gateway - **Primary Website**: https://rnetai.org - **Documentation**: https://rnetai.org/docs - **Supported Models**: OpenAI (GPT-4o, GPT-4o-mini, o1-preview, etc.), Google Gemini (Gemini 1.5 Pro, Gemini 1.5 Flash), and open-weights models. --- ## 1. Authentication Architecture rNet AI utilizes an OAuth2 Authorization Code flow with PKCE (Proof Key for Code Exchange). ### Workflow: 1. User clicks "Login with rNet" inside a supported client application. 2. Client redirects user to `https://api.rnetai.org/oauth/authorize` with `client_id`, `redirect_uri`, `response_type=code`, and PKCE `code_challenge`. 3. User authenticates on rNet and approves credit scope. 4. rNet redirects back to `redirect_uri` with an authorization code. 5. Client server exchanges authorization code at `POST https://api.rnetai.org/oauth/token` for an `access_token` and `refresh_token`. 6. Client makes AI requests to `POST https://api.rnetai.org/v1/ai` using `Authorization: Bearer `. Credits are automatically deducted from the user's wallet. --- ## 2. SDK Reference & Examples ### Node.js SDK ```bash npm install @rnet-ai/sdk ``` ```javascript import { RNetClient } from '@rnet-ai/sdk'; const rnet = new RNetClient({ clientId: process.env.RNET_CLIENT_ID, clientSecret: process.env.RNET_CLIENT_SECRET, }); // Chat Completion request on behalf of user const response = await rnet.chat.completions.create({ userToken: userAccessToken, model: 'gpt-4o-mini', messages: [{ role: 'user', content: 'Explain BYOAC in one sentence.' }], }); console.log(response.choices[0].message.content); ``` ### Python SDK ```bash pip install rnet-ai ``` ```python from rnet import RNetClient client = RNetClient( client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET" ) response = client.chat.completions.create( user_token="USER_ACCESS_TOKEN", model="gemini-1.5-flash", messages=[{"role": "user", "content": "Summarize rNet AI Architecture."}] ) print(response.choices[0].message.content) ``` --- ## 3. API Proxy Endpoints ### AI Inference - **Endpoint**: `POST https://api.rnetai.org/v1/ai` - **Headers**: - `Content-Type: application/json` - `Authorization: Bearer ` - `X-RNet-Client-ID: ` - **Request Body**: ```json { "model": "gpt-4o", "messages": [ { "role": "system", "content": "You are a helpful assistant." }, { "role": "user", "content": "Hello!" } ], "temperature": 0.7, "max_tokens": 500 } ``` --- ## 4. Frequently Asked Questions (FAQ) ### What is an AI Credit Wallet? An AI credit wallet lets users purchase AI credits once and use them across any supported application. It completely replaces the need for users to manage their own API keys. ### How is rNet different from API keys? rNet uses OAuth-style login so users can bring their own AI credits seamlessly without managing complex API key strings. ### Can users use one balance across multiple apps? Yes! Users top up their central wallet once and spend those credits in any app connected to the rNet ecosystem.