Automata 1RPC
  • LLM relay
    • Overview
  • Using the LLM API
    • Getting started
    • Models
    • Payment
    • Authentication
    • Errors
  • Web3 Relay
    • Overview
  • USING THE WEB3 API
    • Getting started
    • Transaction sanitizers
    • Networks
    • Payment
      • How to make a payment
        • Fiat Payment
        • Crypto Payment
      • How to top up crypto payment
      • How to change billing cycle
      • How to change from fiat to crypto payment
      • How to change from crypto to fiat payment
      • How to upgrade or downgrade plan
      • How to cancel a plan
      • How to update credit card
      • How to view payment history
      • Policy
    • Errors
  • Getting help
    • Discord
    • Useful links
Powered by GitBook
On this page
  1. Using the LLM API

Getting started

1RPC.ai provides a single endpoint with access to 23+ verified LLM models. The API is made available via the 1RPC.ai dashboard. At the same time, monitor and control spending across different AI models with aggregated usage in one place.

Immediately rotate your API key if you suspect that it has been leaked, compromised, or misused.

import requests
import json

response = requests.post(
    url="https://1rpc.ai/v1/chat/completions",
    headers={
        "Authorization": "Bearer <1RPC_AI_API_KEY>",
        "Content-Type": "application/json",
        "Accept": "application/json",
    },
    data=json.dumps({
        "model":"openai/gpt-4o",
        "messages": [
            {
                "role": "user",
                "content": "What is the meaning of life?"
            }
        ]
    }]
)
fetch('https://1rpc.ai/v1/chat/completions', {
    method: 'Post',
    headers: {
        Authorization: 'Bearer <1RPC_AI_API_KEY>',
        'Content-Type': 'application/json',
    },
    body: JSON.stringify({
        model: 'openai/gpt-4o',
        messages: [
            {
                role: 'user',
                content: 'What is the meaning of life?'
            },
        ],
    }),
});
curl https://1rpc.ai/v1/chat/completions \
    -H "Content-Type" application/json" \
    -H "Authorization: Bearer $ONERPC_AI_API_KEY" \
    -d '{
    "model": openai/gpt-4o",
    "messages": [
        {
            "role": "user",
            "content": "What is the meaning of life?"
        }
    ]
}'
PreviousOverviewNextModels

Last updated 23 days ago

Page cover image