AI requests
Send a request to any supported model on behalf of a signed-in user. rNet charges the user's credits and returns the provider's response unchanged.
Send a request
POSThttps://ai-provider.rnetai.org/ai
| Name | In | Description |
|---|---|---|
modelstringrequired | query | Model ID, for example gemini-2.5-flash-lite. See Models. |
access_tokenstringrequired | query | The user's access token from Connect with rNet. |
bodyJSONrequired | body | The provider's own request body. Send Content-Type: application/json. |
bash
curl -X POST "https://ai-provider.rnetai.org/ai?model=gemini-2.5-flash-lite&access_token=$ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"contents":[{"role":"user","parts":[{"text":"Hello!"}]}]}'Stream a response
POSThttps://ai-provider.rnetai.org/ai/stream
Same parameters as /ai. The response is streamed as the provider generates it (server-sent events for Gemini models). For Groq models, also set "stream": true in the body.
Request body by provider
rNet does not change the body, so use the format each provider expects:
json
// Gemini / Gemma (Google): generateContent
{ "contents": [{ "role": "user", "parts": [{ "text": "Hello!" }] }] }
// gemini-embedding-001: embedContent
{ "content": { "parts": [{ "text": "Text to embed" }] } }
// Groq models: OpenAI-style chat completions
{ "model": "llama-3.1-8b-instant", "messages": [{ "role": "user", "content": "Hello!" }] }
// text-embedding-3-small (OpenAI): embeddings
{ "model": "text-embedding-3-small", "input": "Text to embed" }Response
On success you receive the provider's response with HTTP 200. On failure you receive an error object; see Errors.
Billing
rNet checks the user's balance before forwarding the request and deducts the credits used afterwards. If the balance is too low, the request fails with
402 and nothing is sent to the provider.