### C# SDK Example Source: https://docs.llmgateway.io/quick-start Example demonstrating LLM Gateway integration using the C# SDK. Ensure the NuGet package is installed. ```csharp using LLMGateway; var apiKey = Environment.GetEnvironmentVariable("LLM_GATEWAY_API_KEY"); var llm = new LLMGatewayClient(apiKey); var response = await llm.Completions.CreateAsync( model: "gpt-3.5-turbo", prompt: "Hello world" ); Console.WriteLine(response.Choices[0].Message.Content); ``` -------------------------------- ### Ruby SDK Example Source: https://docs.llmgateway.io/quick-start Example of using the Ruby SDK for LLM Gateway integration. Ensure the gem is installed. ```ruby require "llmgateway" llm = LLMGateway::Client.new(api_key: ENV["LLM_GATEWAY_API_KEY"]) response = llm.completions.create({ model: "gpt-3.5-turbo", prompt: "Hello world", }) puts response.choices[0].message.content ``` -------------------------------- ### PHP SDK Example Source: https://docs.llmgateway.io/quick-start Example of using the PHP SDK to interact with LLM Gateway. Ensure the SDK is installed via Composer. ```php completions->create([ 'model' => 'gpt-3.5-turbo', 'prompt' => 'Hello world', ]); echo $response->choices[0]->message->content; ?> ``` -------------------------------- ### Node.js SDK Example Source: https://docs.llmgateway.io/quick-start Example of using the Node.js SDK to interact with LLM Gateway. Ensure the SDK is installed. ```javascript import LLMGateway from "llmgateway"; const llm = new LLMGateway(process.env.LLM_GATEWAY_API_KEY); async function main() { const response = await llm.completions.create({ model: "gpt-3.5-turbo", prompt: "Hello world", }); console.log(response.choices[0].message.content); } main(); ``` -------------------------------- ### Install Node.js and pnpm Source: https://docs.llmgateway.io/guides/agent-skills Ensure you have Node.js 18+ and pnpm 9+ installed before proceeding with the agent skills setup. ```bash node --version # v18.0.0 or higher pnpm --version # 9.0.0 or higher ``` -------------------------------- ### Direct LiteLLM Call Example Source: https://docs.llmgateway.io/migrations/litellm Example of making a direct call to LiteLLM with specified parameters. Ensure you have the 'litellm' library installed. ```python import litellm response = litellm.completion( model="gpt-4", messages=[ {"role": "user", "content": "This is a test"} ], api_key="sk-1234" ) print(response) ``` -------------------------------- ### Python SDK Example Source: https://docs.llmgateway.io/quick-start Example of using the Python SDK to interact with LLM Gateway. Make sure to install the SDK first. ```python from llmgateway import LLMGateway llm = LLMGateway(api_key=os.environ.get("LLM_GATEWAY_API_KEY")) response = llm.completions.create( model="gpt-3.5-turbo", prompt="Hello world" ) print(response.choices[0].message.content) ``` -------------------------------- ### Run Hermes Agent Setup Wizard Source: https://docs.llmgateway.io/guides/hermes-agent Launch the interactive setup wizard for Hermes Agent. You can choose between a quick setup for basic configuration or a full setup for advanced options. ```bash hermes setup ``` -------------------------------- ### Tool Use Example Source: https://docs.llmgateway.io/migrations/litellm Illustrates how to define and use tools with LiteLLM for more complex interactions. This example shows a tool definition for getting weather information. ```json { "type": "function", "function": { "name": "get_weather", "description": "Get the weather for a location", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA" } }, "required": [ "location" ] } } } ``` -------------------------------- ### Example Usage of Provider Keys Source: https://docs.llmgateway.io/learn/provider-keys This snippet demonstrates how to use provider keys in a typical application flow. Ensure you have the necessary SDKs or libraries installed. ```javascript self.__next_f.push([ "37:[\"$\",\"svg\",null,{\"style\":{\"flex\":\"none\",\"lineHeight\":\"1\"},\"fill\":\"currentColor\",\"fillRule\":\"evenodd\",\"xmlns\":\"http://www.w3.org/2000/svg\",\"viewBox\":\"0 0 24 24\",\"children\":[[ \"$\",\"path\",null,{\"d\":\"$6e\"}],[ \"$\",\"path\",null,{\"d\":\"M8.06 10.788c-.003-.038-.004-.075.037-.062.016.006.034.048.028.067-.01.04-.038.032-.064-.005z\"}],[ \"$\",\"path\",null,{\"clipRule\":\"evenodd\",\"d\":\"$6f\"}]]}\] ``` -------------------------------- ### Install OpenCode Desktop on Windows Source: https://docs.llmgateway.io/guides/opencode-desktop Download and run the Windows installer for OpenCode Desktop. ```powershell winget install --id=OpenCode.OpenCode --source winget ``` -------------------------------- ### Docker Compose for Unified Image Source: https://docs.llmgateway.io/self-host This snippet shows how to download the Docker Compose file and environment example, configure environment variables, and start the LLM Gateway service using Docker Compose. ```bash # Download the compose file curl -O https://raw.githubusercontent.com/theopenco/llmgateway/main/infra/docker-compose.unified.yml curl -O https://raw.githubusercontent.com/theopenco/llmgateway/main/.env.unified.example # Configure environment cp .env.unified.example .env # Edit .env with your configuration # Start the service docker compose -f docker-compose.unified.yml up -d ``` -------------------------------- ### Install Dependencies Source: https://docs.llmgateway.io/guides/agent-skills Install all necessary project dependencies using pnpm. ```bash pnpm install ``` -------------------------------- ### Go SDK Example Source: https://docs.llmgateway.io/quick-start Example demonstrating how to use the Go SDK with LLM Gateway. Ensure the SDK is properly imported. ```go package main import ( "fmt" "os" "github.com/theopenco/llmgateway/go" ) func main() { llm := llmgateway.NewLLMGateway(os.Getenv("LLM_GATEWAY_API_KEY")) response, err := llm.Completions.Create( "gpt-3.5-turbo", "Hello world", ) if err != nil { panic(err) } fmt.Println(response.Choices[0].Message.Content) } ``` -------------------------------- ### Set up LiteLLM Source: https://docs.llmgateway.io/migrations/litellm Initialize LiteLLM with your preferred model and API key. Ensure you have the necessary libraries installed. ```python from litellm import completion response = completion( model="gpt/3.5-turbo", messages=[{"role": "user", "content": "This is a test"}] ) ``` -------------------------------- ### Java SDK Example Source: https://docs.llmgateway.io/quick-start Example demonstrating LLM Gateway integration using the Java SDK. Ensure the necessary dependencies are included. ```java import io.llmgateway.LLMGateway; public class Main { public static void main(String[] args) { LLMGateway llm = new LLMGateway(System.getenv("LLM_GATEWAY_API_KEY")); String response = llm.completions().create( "gpt-3.5-turbo", "Hello world" ); System.out.println(response); } } ``` -------------------------------- ### Start Development Server with LLM Gateway CLI Source: https://docs.llmgateway.io/guides/cli Navigate to your project directory and run the LLM Gateway CLI to start the development server. This command initializes your AI application. ```bash cd my-ai-app npx @llmgateway/cli ``` -------------------------------- ### Initialize LiteLLM Client (After Migration) Source: https://docs.llmgateway.io/migrations/litellm Example of initializing the LiteLLM client directly. API keys and base URLs are passed as arguments or set via environment variables. ```python from litellm import completion completion( model="gpt-3.5-turbo", api_key=os.environ.get("OPENAI_API_KEY"), base_url="http://localhost:4000/v1" ) ``` -------------------------------- ### Create a Project Source: https://docs.llmgateway.io/features/master-keys Use this endpoint to create a new project. Ensure you have your master key for authentication. ```bash curl -X POST \ -H "Authorization: Bearer $$MASTER_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "My New Project", "description": "This is a project for testing purposes." }' \ https://internal.llmgateway.io/v1/master/projects ``` -------------------------------- ### Initialize LiteLLM Client (Before Proxy) Source: https://docs.llmgateway.io/migrations/litellm Example of initializing the LiteLLM client with base URL and API key from environment variables, as used with the LiteLLM proxy. ```python from litellm import completion client = completion( model="gpt-3.5-turbo", base_url="http://localhost:4000/v1", api_key=os.environ["LITELLM_API_KEY"] ) ``` -------------------------------- ### Moderation API Example Source: https://docs.llmgateway.io/features/moderations This example demonstrates how to use the moderation API to check for harmful content. Ensure you have the necessary SDKs installed. ```python from llm_gateway.moderations import Moderations moderations = Moderations() async def check_content(text): return await moderations.check(text) async def moderate_content(text): return await moderations.moderate(text) ``` -------------------------------- ### Download and Start Unified Docker Compose Source: https://docs.llmgateway.io/self-host Use this to quickly set up a single container for LLMGateway. Ensure you configure the .env file with your specific settings. ```bash curl -O https://raw.githubusercontent.com/theopenco/llmgateway/main/infra/docker-compose.unified.yml curl -O https://raw.githubusercontent.com/theopenco/llmgateway/main/.env.unified.example cp .env.unified.example .env # Edit .env with your configuration docker compose -f docker-compose.unified.yml up -d ``` -------------------------------- ### AWS Bedrock Embeddings Call Example Source: https://docs.llmgateway.io/integrations/aws-bedrock Example of how to get embeddings for a given text using an AWS Bedrock embedding model. ```python from llmgw.clients import BedrockClient client = BedrockClient(api_key="YOUR_API_KEY") response = client.embed( model="amazon.titan-embed-text-v1", texts=["Hello world", "How are you?"], ) print(response.embeddings) ``` -------------------------------- ### Python OpenAI SDK Example Source: https://docs.llmgateway.io/migrations/litellm Example of updating Python code that uses the OpenAI SDK to work with LiteLLM. Ensure you have the 'openai' library installed. ```python from openai import OpenAI ``` -------------------------------- ### Initialize a New Project with CLI Source: https://docs.llmgateway.io/guides/cli Initialize a new project from a template. Use the --template option to specify a template like 'image-generation' or 'weather-agent'. ```bash npx @llmgateway/cli init npx @llmgateway/cli init --template npx @llmgateway/cli init --template image-generation npx @llmgateway/cli init --name npx @llmgateway/cli init --template weather-agent --name my-weather-project ``` -------------------------------- ### Install LLM Gateway Provider Source: https://docs.llmgateway.io/migrations/vercel-ai-gateway Install the native LLM Gateway provider for the Vercel AI SDK. This is a necessary step before you can start using LLM Gateway. ```bash npm install @llm-gateway/vercel-ai-sdk ``` -------------------------------- ### Start LLM Gateway Development Server Source: https://docs.llmgateway.io/guides/cli Navigate to your project directory and start the development server. A custom port can be specified. ```bash cd my-ai-app npx @llmgateway/cli dev ``` ```bash npx @llmgateway/cli dev --port 3000 ``` -------------------------------- ### Retrieve Video Content (Python) Source: https://docs.llmgateway.io/v1_videos_retrieve Python code example for retrieving video content. It shows how to make a GET request and process the JSON response. ```python import requests response = requests.get("https://example.com/v1/videos/string") video_data = response.json() print(video_data) ``` -------------------------------- ### Initialize LiteLLM Client with Direct API Key Source: https://docs.llmgateway.io/migrations/litellm Demonstrates initializing the LiteLLM client by directly providing the API key, bypassing environment variables for specific calls. ```python from litellm import completion completion( model="gpt-3.5-turbo", api_key="sk-1234567890", base_url="http://localhost:4000/v1" ) ``` -------------------------------- ### MCP Configuration Example Source: https://docs.llmgateway.io/guides/mcp This snippet demonstrates a basic configuration structure for MCP, likely for setting up model parameters or network settings. ```text T4b5,M24 8.4c0 1.325-1.102 2.4-2.462 2.4-1.146 0-2.11-.765-2.384-1.8h-3.436c-.602 0-1.115.424-1.214 1.003l-.101.592a2.38 2.38 0 0 1-.8 1.405c.412.354.704.844.8 1.405l.1.592A1.222 1.222 0 0 0 15.719 15h.975c.273-1.035 1.237-1.8 2.384-1.8 1.36 0 2.461 1.075 2.461 2.4S20.436 18 19.078 18c-1.147 0-2.11-.765-2.384-1.8h-.975c-1.204 0-2.23-.848-2.428-2.005l-.101-.592a1.222 1.222 0 0 0-1.214-1.003H10.97c-.308.984-1.246 1.7-2.356 1.7-1.11 0-2.048-.716-2.355-1.7H4.817c-.308.984-1.246 1.7-2.355 1.7C1.102 14.3 0 13.225 0 11.9s1.102-2.4 2.462-2.4c1.183 0 2.172.815 2.408 1.9h1.337c.236-1.085 1.225-1.9 2.408-1.9 1.184 0 2.172.815 2.408 1.9h.952c.601 0 1.115-.424 1.213-1.003l.102-.592c.198-1.157 1.225-2.005 2.428-2.005h3.436c.274-1.035 1. ``` -------------------------------- ### OpenRouter Migration Guide Source: https://docs.llmgateway.io/migrations/openrouter This section outlines the steps and considerations for migrating from OpenRouter to LLM Gateway, including API endpoint mappings and example requests. ```APIDOC ## Migrating from OpenRouter to LLM Gateway This guide details how to transition your existing OpenRouter integrations to leverage the LLM Gateway API. ### Key Considerations * **API Endpoints**: Understand the mapping between OpenRouter's endpoints and LLM Gateway's equivalent endpoints. * **Authentication**: Ensure your authentication methods are compatible or updated for LLM Gateway. * **Model Names**: Be aware of any differences in model naming conventions. ### Example Migration Steps This section provides conceptual examples. Please refer to the specific LLM Gateway API documentation for exact request and response formats. #### 1. Chat Completions OpenRouter's Chat Completions endpoint can be mapped to LLM Gateway's Chat Completions endpoint. **OpenRouter Example (Conceptual):** ```http POST https://openrouter.ai/api/v1/chat/completions Content-Type: application/json Authorization: Bearer YOUR_OPENROUTER_API_KEY { "model": "openai/gpt-3.5-turbo", "messages": [ {"role": "user", "content": "Hello!" } ] } ``` **LLM Gateway Equivalent (Conceptual): ** ```http POST https://api.llmgateway.io/v1/chat/completions Content-Type: application/json Authorization: Bearer YOUR_LLMGATEWAY_API_KEY { "model": "openai/gpt-3.5-turbo", "messages": [ {"role": "user", "content": "Hello!" } ] } ``` ### 2. Model Listing Migrating from fetching models via OpenRouter to LLM Gateway. **OpenRouter Example (Conceptual):** ```http GET https://openrouter.ai/api/v1/models Authorization: Bearer YOUR_OPENROUTER_API_KEY ``` **LLM Gateway Equivalent (Conceptual):** ```http GET https://api.llmgateway.io/v1/models Authorization: Bearer YOUR_LLMGATEWAY_API_KEY ``` ### Further Assistance For detailed API specifications, refer to the official LLM Gateway API documentation. ``` -------------------------------- ### Retrieve Video Content (Python) Source: https://docs.llmgateway.io/v1_videos_content Python code to stream video content. This example demonstrates making a GET request and saving the response body as a file. ```python import requests url = "https://llmgateway.io/v1/videos/content?id=..." api_key = "YOUR_API_KEY" headers = { "accept": "application/octet-stream", "Authorization": f"Bearer {api_key}" } response = requests.get(url, headers=headers, stream=True) if response.status_code == 200: with open("output.mp4", "wb") as f: for chunk in response.iter_content(chunk_size=8192): f.write(chunk) print("Video saved to output.mp4") else: print(f"Error: {response.status_code}") print(response.text) ``` -------------------------------- ### Create a Project with Master Key Source: https://docs.llmgateway.io/features/master-keys Use this endpoint to create a new project. Provide the project name, and optionally enable caching and set a cache duration. The mode can be 'api-keys', 'credits', or 'hybrid'. ```bash curl -X POST https://api.llmgateway.ai/v1/master/projects \ -H "Authorization: Bearer YOUR_MASTER_KEY" \ -d '{ "name": "Customer ACME", "cachingEnabled": false, "mode": "hybrid" }' ``` -------------------------------- ### Retrieve Video Content (C#) Source: https://docs.llmgateway.io/v1_videos_content C# example for fetching video content from the LLM Gateway API. This uses the HttpClient class to perform a GET request. ```csharp using System; using System.Net.Http; using System.Threading.Tasks; public class VideoFetcher { public static async Task GetVideoContent() { using (HttpClient client = new HttpClient()) { string url = "https://example.com/v1/videos/string/content"; HttpResponseMessage response = await client.GetAsync(url); if (response.IsSuccessStatusCode) { string content = await response.Content.ReadAsStringAsync(); Console.WriteLine("Success!"); // Process content } else { Console.WriteLine($"Error: {response.StatusCode}"); } } } } ``` -------------------------------- ### Initialize a new LLM Gateway project Source: https://docs.llmgateway.io/guides/cli Use the 'init' command to scaffold a new LLM Gateway project. This sets up the basic project structure and configuration files. ```bash npx @llmgateway/cli init ``` -------------------------------- ### Retrieve Video Content (JavaScript) Source: https://docs.llmgateway.io/v1_videos_content Example of retrieving video content using JavaScript. This snippet demonstrates a basic GET request to the LLM Gateway API. ```javascript fetch("https://example.com/v1/videos/string/content", { method: "GET" }).then(response => { // Handle response }); ``` -------------------------------- ### Create Project Source: https://docs.llmgateway.io/features/master-keys Create a new project within the master key's organization. Specify the project name and optional caching configurations. ```bash curl -X POST https://internal.llmgateway.io/v1/master/projects \ -H "Authorization: Bearer $MASTER_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Customer ACME", "cachingEnabled": false, "mode": "hybrid" }' ``` -------------------------------- ### Send a Request with System Prompt via CLI Source: https://docs.llmgateway.io/guides/cline This example demonstrates sending a request that includes a system prompt, which helps guide the model's behavior. ```bash llmcli send --model "gpt-4" --prompt "Write a short poem about the sea." --system-prompt "You are a helpful assistant that writes poetry." ``` -------------------------------- ### Migrate OpenAI Client Initialization Source: https://docs.llmgateway.io/migrations/litellm Shows how to initialize the OpenAI client using LiteLLM's proxy before and after migration. This example demonstrates the change in client initialization when switching from direct OpenAI SDK usage to LiteLLM's proxy. ```typescript import OpenAI // Before (LiteLLM proxy) const client = new OpenAI({ baseURL: "http://localhost:8000", }); // After (LiteLLM proxy) const client = new OpenAI({ baseURL: "http://localhost:8000", }); ``` -------------------------------- ### Create Chat Completion with OpenAI Model Source: https://docs.llmgateway.io/migrations/litellm Example of how to create a chat completion using the LiteLLM client with an OpenAI model. Ensure you have the LiteLLM client installed and configured. ```python import litellm response = litellm.completion( model="openai/gpt-4", messages=[ {"role": "user", "content": "What's the weather in Tokyo?"} ] ) ``` -------------------------------- ### LLM Gateway Call with Different Model Source: https://docs.llmgateway.io/migrations/litellm Shows how to use LLM Gateway to call the 'claude-3-sonnet-20240229' model. The setup is similar to the previous example, only changing the model name. ```python from openai import OpenAI client = OpenAI( base_url="https://llm.llmgateway.io", api_key="sk-ant-..." ) response = client.chat.completions.create( model="claude-3-sonnet-20240229", messages=[ {"role": "user", "content": "This is a test"} ] ) print(response) ``` -------------------------------- ### LLMGateway CLI Example Source: https://docs.llmgateway.io/guides/cline This snippet demonstrates a basic command for interacting with the LLMGateway CLI. It's useful for initiating requests or checking service status. ```bash self.__next_f.push([1,"6c:T7c2," ]) self.__next_f.push([1,"m142.27 316.619 73.655-41.326 1.238-3.589-1.238-1.996-3.589-.001-12.31-.759-42.084-1.138-36.498-1.516-35.361-1.896-8.897-1.895-8.34-10.995.859-5.484 7.482-5.03 10.717.935 23.683 1.617 35.537 2.452 25.782 1.517 38.193 3.968h6.064l.86-2.451-2.073-1.517-1.618-1.517-36.776-24.922-39.81-26.338-20.852-15.166-11.273-7.683-5.687-7.204-2.451-15.721 10.237-11.273 13.75.935 3.513.936 13.928 10.716 29.749 23.027 38.848 28.612 5.687 4.727 2.275-1.617.278-1.138-2.553-4.271-21.13-38.193-22.546-38.848-10.035-16.101-2.654-9.655c-.935-3.968-1.617-7.304-1.617-11.374l11.652-15.823 6.445-2.073 15.545 2.073 6.547 5.687 9.655 22.092 15.646 34.78 24.265 47.291 7.103 14.028 3.791 12.992 1.416 3.968 2.449-.001v-2.275l1.997-26.641 3.69-32.707 3.589-42.084 1.239-11.854 5.863-14.206 11.652-7.683 9.099 4.348 7.482 10.716-1.036 6.926-4.449 28.915-8.72 45.294-5.687 30.331h3.313l3.792-3.791 15.342-20.372 25.782-32.227 11.374-12.789 13.27-14.129 8.517-6.724 16.1-.001 11.854 17.617-5.307 18.199-16.581 21.029-13.75 17.819-19.716 26.54-12.309 21.231 1.138 1.694 2.932-.278 44.536-9.479 24.062-4.347 28.714-4.928 12.992 6.066 1.416 6.167-5.106 12.613-30.71 7.583-36.018 7.204-53.636 12.689-.657.48.758.935 24.164 2.275 10.337.556h25.301l47.114 3.514 12.309 8.139 7.381 9.959-1.238 7.583-18.957 9.655-25.579-6.066-59.702-14.205-20.474-5.106-2.83-.001v1.694l17.061 16.682 31.266 28.233 39.152 36.397 1.997 8.999-5.03 7.102-5.307-.758-34.401-25.883-13.27-11.651-30.053-25.302-1.996-.001v2.654l6.926 10.136 36.574 54.975 1.895 16.859-2.653 5.485-9.479 3.311-10.414-1.895-21.408-30.054-22.092-33.844-17.819-30.331-2.173 1.238-10.515 113.261-4.929 5.788-11.374 4.348-9.478-7.204-5.03-11.652 5.03-23.027 6.066-30.052 4.928-23.886 4.449-29.674 2.654-9.858-.177-.657-2.173.278-22.37 30.71-34.021 45.977-26.919 28.815-6.445 2.553-11.173-5.789 1.037-10.337 6.243-9.2 37.257-47.392 22.47-29.371 14.508-16.961-.101-2.451h-.859l-98.954 64.251-17.618 2.275-7.583-7.103.936-11.652 3.589-3.791 29.749-20.474-.101.102.024.101z"] ``` -------------------------------- ### Configure LLM Gateway API Key Source: https://docs.llmgateway.io/guides/hermes-agent Paste your LLM Gateway API key when prompted by the Hermes Agent setup wizard. The key typically starts with 'llmgtwy_'. ```bash API key: llmgtwy_... ``` -------------------------------- ### Retrieve Video Content (Go) Source: https://docs.llmgateway.io/v1_videos_content A Go program to fetch video content from the LLM Gateway API. This example shows how to make a GET request and handle the response. ```go package main import ( "fmt" "net/http" ) func main() { resp, err := http.Get("https://example.com/v1/videos/string/content") if err != nil { fmt.Println("Error making request:", err) return } defer resp.Body.Close() // Process response body fmt.Println("Status Code:", resp.StatusCode) } ``` -------------------------------- ### Chat Completion Request (Node.js) Source: https://docs.llmgateway.io/v1_chat_completions An example of making a chat completion request using the OpenAI Node.js library. Make sure to install the library and set up your API key. ```javascript import OpenAI from 'openai'; const openai = new OpenAI(); async function main() { const completion = await openai.chat.completions.create({ model: "gpt-3.5-turbo", messages: [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hello!"} ], }); console.log(completion.choices[0].message.content); } main(); ``` -------------------------------- ### LLM Gateway Client Initialization Source: https://docs.llmgateway.io/migrations/openrouter This example demonstrates the initialization of a client for the LLM Gateway, which is a common pattern when integrating with various LLM providers through a unified interface. ```javascript const client = new LLM( // LLM Gateway provider configuration { provider: "openrouter", provider_options: { api_key: process.env.OPENROUTER_API_KEY, }, } ); ``` -------------------------------- ### Initialize LLM Gateway SDK Source: https://docs.llmgateway.io/migrations/openrouter Set up the LLM Gateway SDK by providing your API key. Ensure the LLMGATEWAY_API_KEY environment variable is set. ```javascript const llmgateway = require("@llmgateway/ai-sdk-provider"); const { createLLMGateway } = llmgateway; const { LLMGATEWAY_API_KEY } = process.env; ``` -------------------------------- ### LLM Gateway with System Message Source: https://docs.llmgateway.io/self-host This example demonstrates including a system message in the conversation to guide the LLM's behavior. System messages set the context or persona for the AI. ```python import requests url = "http://localhost:8000/v1/chat/completions" headers = { "Content-Type": "application/json" } data = { "model": "default", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Who won the world series in 2020?"} ] } response = requests.post(url, headers=headers, json=data) print(response.json()) ```