### Install dependencies and start the CLI Source: https://docs.routeway.ai/integrations/agents/gemini-cli Install the required Node.js dependencies and launch the CLI application. ```bash npm install npm start ``` -------------------------------- ### Install OpenCode Source: https://docs.routeway.ai/integrations/agents/opencode Install OpenCode using either the official install script or npm. Choose one method based on your preference. ```bash curl -fsSL https://opencode.ai/install | bash ``` ```bash npm install -g opencode-ai ``` -------------------------------- ### Basic Tool Calling Example in Python Source: https://docs.routeway.ai/guides/chat-completions/tool-calling Shows how to define a weather tool, send a request with tool_choice 'auto', handle the model's tool_calls, execute the function locally, and send the result back to get the final answer. Requires the OpenAI Python client and a ROUTEWAY_API_KEY environment variable. ```python import os import json from openai import OpenAI client = OpenAI( base_url="https://api.routeway.ai/v1", api_key=os.getenv("ROUTEWAY_API_KEY") ) # Step 1: Define tools tools = [ { "type": "function", "function": { "name": "get_weather", "description": "Get the current weather for a given city.", "parameters": { "type": "object", "properties": { "city": { "type": "string", "description": "The city name, e.g. 'London'" }, "unit": { "type": "string", "enum": ["celsius", "fahrenheit"], "description": "Temperature unit" } }, "required": ["city"], "additionalProperties": False }, "strict": True } } ] messages = [{"role": "user", "content": "What's the weather like in Paris right now?"}] # Step 2: Send request with tools response = client.chat.completions.create( model="gpt-4o", messages=messages, tools=tools, tool_choice="auto", ) message = response.choices[0].message # Step 3: Check if model wants to call a tool if message.tool_calls: for tool_call in message.tool_calls: args = json.loads(tool_call.function.arguments) print(f"Model wants to call: {tool_call.function.name}({args})") # Step 4: Execute the function (your logic here) result = {"temperature": 18, "conditions": "Partly cloudy", "city": args["city"]} # Step 5: Send result back messages.append(message) messages.append({ "role": "tool", "tool_call_id": tool_call.id, "content": json.dumps(result) }) # Step 6: Get final answer final = client.chat.completions.create( model="gpt-4o", messages=messages, tools=tools, ) print(final.choices[0].message.content) ``` -------------------------------- ### Response for GET /v1/account/keys/{key_id} Source: https://docs.routeway.ai/account-management/api-key-management Example JSON response from the GET /v1/account/keys/{key_id} endpoint. Contains the key details including masked key, label, daily and minute limits, balance, usage metrics, timestamps, and subscription/PAYG flags. ```json { "data": { "api_key_id": 1, "key": "rw-abc1234...5678", "label": "production", "daily_limit": 1000, "minute_limit": 60, "balance": 10.00, "usage_today": 3.21, "usage_minute": 0, "created_at": "2025-06-01T00:00:00Z", "last_used_at": "2025-06-15T11:00:00Z", "use_subs_first": true, "fallback_to_payg": false } } ``` -------------------------------- ### Basic Tool Calling Example in Node.js Source: https://docs.routeway.ai/guides/chat-completions/tool-calling Shows how to define a weather tool, send a request with tool_choice 'auto', handle the model's tool_calls, execute the function locally, and send the result back to get the final answer. Requires the OpenAI Node.js client and a ROUTEWAY_API_KEY environment variable. ```javascript import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.routeway.ai/v1", apiKey: process.env.ROUTEWAY_API_KEY, }); const tools = [ { type: "function", function: { name: "get_weather", description: "Get the current weather for a given city.", parameters: { type: "object", properties: { city: { type: "string", description: "The city name" }, unit: { type: "string", enum: ["celsius", "fahrenheit"] }, }, required: ["city"], additionalProperties: false, }, strict: true, }, }, ]; async function main() { const messages = [ { role: "user", content: "What's the weather like in Paris right now?" }, ]; const response = await client.chat.completions.create({ model: "gpt-4o", messages, tools, tool_choice: "auto", }); ``` -------------------------------- ### Start Codex CLI Source: https://docs.routeway.ai/integrations/agents/codex Run this command in your project directory to start Codex. Requests will be sent through Routeway using the provider defined in config.toml. ```bash codex ``` -------------------------------- ### Prompt example: composition and perspective Source: https://docs.routeway.ai/core-concepts/image-generation/generating-images A prompt that describes the subject, composition, and camera angle to guide the model on placement and viewpoint. ```text "Close-up portrait of an elderly sailor, weathered face, looking off-camera, shallow depth of field, golden hour light" ``` -------------------------------- ### Verify Grok CLI Installation Source: https://docs.routeway.ai/integrations/agents/grok-cli Check that the Grok CLI is correctly installed by displaying its version. ```bash grok --version ``` -------------------------------- ### Make First Request with Python Source: https://docs.routeway.ai/getting-started/quickstart Install the OpenAI library and use it to interact with the Routeway API. ```bash pip install openai ``` ```python import os from openai import OpenAI client = OpenAI( base_url="https://api.routeway.ai/v1", api_key=os.getenv("ROUTEWAY_API_KEY") ) response = client.chat.completions.create( model="gpt-4o-mini", messages=[ {"role": "user", "content": "Write a short story about a robot and a cat."} ] ) print(response.choices[0].message.content) ``` -------------------------------- ### Make First Request with Node.js Source: https://docs.routeway.ai/getting-started/quickstart Install the OpenAI library and use it to interact with the Routeway API. ```bash npm install openai ``` ```javascript const { OpenAI } = require("openai"); const client = new OpenAI({ base_url: "https://api.routeway.ai/v1", api_key: process.env.ROUTEWAY_API_KEY, }); async function main() { const response = await client.chat.completions.create({ model: "gpt-4o-mini", messages: [ { role: "user", content: "Write a short story about a robot and a cat." } ] }); console.log(response.choices[0].message.content); } main().catch(console.error); ``` -------------------------------- ### Start Droid CLI Source: https://docs.routeway.ai/integrations/agents/droid Launch the Droid agent in your terminal after completing the configuration. ```bash droid ``` -------------------------------- ### Install Claude Code Source: https://docs.routeway.ai/integrations/agents/claude-code Installation commands for different platforms. ```bash curl -fsSL https://claude.ai/install.sh | bash ``` ```powershell irm https://claude.ai/install.ps1 | iex ``` ```bash npm install -g @anthropic-ai/claude-code ``` -------------------------------- ### Start Claude Code Source: https://docs.routeway.ai/integrations/agents/claude-code Command to launch Claude Code in your project directory. ```bash claude ``` -------------------------------- ### Maximizing cache hits with OpenAI Python client Source: https://docs.routeway.ai/guides/chat-completions/caching Python example using the OpenAI client with Routeway base URL. It places a stable system prompt at the start of the messages array to maximize cache hits, and prints the cached token count. ```python import os from openai import OpenAI client = OpenAI( base_url="https://api.routeway.ai/v1", api_key=os.getenv("ROUTEWAY_API_KEY") ) # Put stable, long content at the START of the messages array SYSTEM_PROMPT = """ You are an expert legal document reviewer with 20 years of experience... [2,000+ tokens of stable instructions and reference material] """ def review_clause(clause_text: str) -> str: response = client.chat.completions.create( model="gpt-4o", messages=[ {"role": "system", "content": SYSTEM_PROMPT}, # cached after first call {"role": "user", "content": f"Review this clause:\n\n{clause_text}"} # changes per request ], ) usage = response.usage cached = usage.prompt_tokens_details.cached_tokens if usage.prompt_tokens_details else 0 print(f"Cached tokens: {cached} / {usage.prompt_tokens}") return response.choices[0].message.content ``` -------------------------------- ### Launch OpenClaude Source: https://docs.routeway.ai/integrations/agents/openclaude Run the openclaude command in your terminal to start the OpenClaude chat client. ```bash openclaude ``` -------------------------------- ### Tool description example Source: https://docs.routeway.ai/guides/chat-completions/tool-calling Example of a clear tool description that specifies what the tool does and when to use it. Descriptions directly influence the model's decision to call the tool. ```json "description": "Search the internal knowledge base for articles about a topic. Use this when the user asks about product features, pricing, or support issues." ``` -------------------------------- ### List Available Models for Grok CLI Source: https://docs.routeway.ai/integrations/agents/grok-cli Examples of model flags for Grok and other providers accessible through Routeway. ```bash # Grok models grok --model grok-3 grok --model grok-3-fast grok --model grok-3-mini # Other providers through Routeway grok --model gpt-4.1 grok --model claude-sonnet-4.5 grok --model gemini-2.5-flash ``` -------------------------------- ### Install Grok CLI Source: https://docs.routeway.ai/integrations/agents/grok-cli Install the Grok CLI globally using npm. Requires Node.js 18 or newer. ```bash npm install -g @vibe-kit/grok-cli ``` -------------------------------- ### Install Droid CLI Source: https://docs.routeway.ai/integrations/agents/droid Run this command in your terminal to install the Droid CLI tool. ```bash curl -fsSL https://app.factory.ai/cli | sh ``` -------------------------------- ### List models with cURL, Python, and Node.js Source: https://docs.routeway.ai/getting-started/models Fetch the live model catalog from the Routeway API. The cURL command returns the raw JSON list; the Python and Node.js examples use the OpenAI SDK with the Routeway base URL and require the ROUTEWAY_API_KEY environment variable. Each example prints or returns the model IDs from the response. ```bash curl https://api.routeway.ai/v1/models ``` ```python import os from openai import OpenAI client = OpenAI( base_url="https://api.routeway.ai/v1", api_key=os.getenv("ROUTEWAY_API_KEY") ) models = client.models.list() for model in models.data: print(model.id) ``` ```javascript import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.routeway.ai/v1", apiKey: process.env.ROUTEWAY_API_KEY, }); const models = await client.models.list(); models.data.forEach((model) => console.log(model.id)); ``` -------------------------------- ### Few-shot Examples for Formatting Source: https://docs.routeway.ai/core-concepts/chat-completions/messages-and-roles Prepend user and assistant message pairs to demonstrate the desired output format to the model. ```json [ { "role": "user", "content": "Classify: 'I love this product!'" }, { "role": "assistant", "content": "positive" }, { "role": "user", "content": "Classify: 'Broke after one day.'" }, { "role": "assistant", "content": "negative" }, { "role": "user", "content": "Classify: 'It is okay I guess.'" } ] ``` -------------------------------- ### Get key details with GET /v1/account/keys/{key_id} Source: https://docs.routeway.ai/account-management/api-key-management Retrieves detailed information about a specific API key using the GET /v1/account/keys/{key_id} endpoint. The Python example prints the label, usage today, daily limit, and last used time from the response. The cURL example sends the request with an Authorization header using the ROUTEWAY_MANAGEMENT_KEY environment variable. ```python key_id = 1 response = requests.get( f"https://api.routeway.ai/v1/account/keys/{key_id}", headers=headers ) detail = response.json()["data"] print(f"Label: {detail['label']}") print(f"Usage today: ${detail['usage_today']:.2f}") print(f"Daily limit: {detail['daily_limit']}") print(f"Last used: {detail['last_used_at']}") ``` ```bash curl https://api.routeway.ai/v1/account/keys/1 \ -H "Authorization: Bearer $ROUTEWAY_MANAGEMENT_KEY" ``` -------------------------------- ### List Keys API Response Source: https://docs.routeway.ai/account-management/api-key-management Example JSON response structure returned by the GET /v1/account/keys endpoint. ```json { "data": [ { "api_key_id": 1, "key": "rw-abc1234...5678", "label": "production", "daily_limit": 1000, "created_at": "2025-06-01T00:00:00Z" }, { "api_key_id": 2, "key": "rw-def5678...9012", "label": "staging", "daily_limit": 100, "created_at": "2025-06-10T00:00:00Z" } ] } ``` -------------------------------- ### Response shape for GET /v1/models Source: https://docs.routeway.ai/getting-started/models Example response shape returned by the GET /v1/models endpoint. Shows the list object with a data array containing model metadata such as id, context_length, pricing, capabilities, supported_parameters, and benchmarks. The response includes a single model entry (kimi-k2.7-code) with pricing per million tokens and caching read pricing. ```json { "object": "list", "data": [ { "id": "kimi-k2.7-code", "name": "MoonshotAI: Kimi K2.7 Code", "short_name": "Kimi K2.7 Code", "description": "Kimi K2.7 Code is Moonshot AI's coding-focused agentic model...", "context_length": 262144, "created": 1781222400, "owned_by": "moonshot-ai", "available": true, "endpoints": ["/v1/chat/completions", "/v1/responses", "/v1/messages"], "pricing": { "input": { "unit": "1M tokens", "price_per_million_t": 0.95 }, "output": { "unit": "1M tokens", "price_per_million_t": 4.0 }, "caching": { "read": { "unit": "1M tokens", "price_per_million_t": 0.2 } } }, "capabilities": { "vision": true, "function_call": true, "reasoning": true }, "supported_parameters": ["temperature", "top_p", "tools", "tool_choice", "..."], "benchmarks": { "gpqa": 0.866, "lcr": 0.733, "tau2": 0.942 } } ] } ``` -------------------------------- ### Connect Routeway API key in OpenCode Source: https://docs.routeway.ai/integrations/agents/opencode Start OpenCode in your project directory, then run /connect to open the provider connection flow. Select Routeway, paste your API key, and save the credential. ```bash opencode ``` ```bash /connect ``` -------------------------------- ### Initialize Routeway with Python OpenAI SDK Source: https://docs.routeway.ai/integrations/other Use the OpenAI Python client by setting the base_url to the Routeway API endpoint. ```python from openai import OpenAI client = OpenAI( api_key="YOUR_ROUTEWAY_API_KEY", base_url="https://api.routeway.ai/v1" ) response = client.chat.completions.create( model="gpt-4.1", messages=[{"role": "user", "content": "Hello!"}] ) ``` -------------------------------- ### Accumulate and execute tool calls in Python Source: https://docs.routeway.ai/guides/chat-completions/streaming This example shows how to stream a chat completion, accumulate tool call arguments from delta chunks, and execute the function after the stream completes. ```python import json import os from openai import OpenAI client = OpenAI( base_url="https://api.routeway.ai/v1", api_key=os.getenv("ROUTEWAY_API_KEY") ) tools = [ { "type": "function", "function": { "name": "get_weather", "description": "Get current weather for a city.", "parameters": { "type": "object", "properties": { "city": {"type": "string"} }, "required": ["city"], }, }, } ] stream = client.chat.completions.create( model="gpt-4o", messages=[{"role": "user", "content": "What's the weather in Tokyo?"}], tools=tools, stream=True, ) tool_call_chunks = {} for chunk in stream: delta = chunk.choices[0].delta # Accumulate text content if delta.content: print(delta.content, end="", flush=True) # Accumulate tool call arguments if delta.tool_calls: for tc in delta.tool_calls: idx = tc.index if idx not in tool_call_chunks: tool_call_chunks[idx] = {"id": tc.id, "name": tc.function.name, "args": ""} if tc.function.arguments: tool_call_chunks[idx]["args"] += tc.function.arguments # After stream ends, execute the tool for tc in tool_call_chunks.values(): args = json.loads(tc["args"]) print(f"\nCalling {tc['name']} with {args}") ``` -------------------------------- ### GET /v1/account/keys Source: https://docs.routeway.ai/api-reference/overview Lists all API keys associated with the account. ```APIDOC ## GET /v1/account/keys ### Description List all API keys on your account. ### Method GET ### Endpoint /v1/account/keys ### Authentication Authorization: Bearer YOUR_ROUTEWAY_API_KEY ### Response #### Success Response (200) - **keys** (array) - List of API keys #### Response Example { "keys": [ { "id": "key_123", "name": "My Key", "created": "2024-01-01T00:00:00Z" } ] } ``` -------------------------------- ### GET /v1/account/analytics Source: https://docs.routeway.ai/api-reference/overview Returns aggregated usage analytics for the account. ```APIDOC ## GET /v1/account/analytics ### Description Aggregated usage analytics. ### Method GET ### Endpoint /v1/account/analytics ### Authentication Authorization: Bearer YOUR_ROUTEWAY_API_KEY ### Response #### Success Response (200) - **analytics** (object) - Aggregated usage data #### Response Example { "analytics": { "total_requests": 1000, "total_tokens": 50000 } } ``` -------------------------------- ### Enable Web Search in Python Source: https://docs.routeway.ai/core-concepts/responses/built-in-tools Use the web_search_preview tool to allow the model to search for current information. ```python import os from openai import OpenAI client = OpenAI( base_url="https://api.routeway.ai/v1", api_key=os.getenv("ROUTEWAY_API_KEY") ) response = client.responses.create( model="gpt-4o", tools=[{"type": "web_search_preview"}], input="What were the top tech news stories today?" ) print(response.output_text) ``` -------------------------------- ### Example API Response Source: https://docs.routeway.ai/account-management/balance-and-usage The JSON structure returned by the /v1/account/activity endpoint. ```json { "data": [ { "model": "gpt-4o", "cost": 0.00042, "created_at": "2025-06-15T12:00:00Z" }, { "model": "claude-sonnet-4-20250514", "cost": 0.00128, "created_at": "2025-06-15T11:58:30Z" } ], "limit": 10, "offset": 0 } ``` -------------------------------- ### Python OpenAI Client Migration Source: https://docs.routeway.ai/getting-started/migration Compare the initialization of the OpenAI client before and after migrating to the Routeway API. ```python import os from openai import OpenAI client = OpenAI( api_key=os.getenv("OPENAI_API_KEY") ) # Calls OpenAI gpt-4o-mini response = client.chat.completions.create( model="gpt-4o-mini", messages=[{"role": "user", "content": "Hello!"}] ) ``` ```python import os from openai import OpenAI client = OpenAI( base_url="https://api.routeway.ai/v1", api_key=os.getenv("ROUTEWAY_API_KEY") ) # Calls Routeway gpt-4o-mini (or any other of the 200+ supported models) response = client.chat.completions.create( model="gpt-4o-mini", messages=[{"role": "user", "content": "Hello!"}] ) ``` -------------------------------- ### Use preset with Python OpenAI client Source: https://docs.routeway.ai/guides/chat-completions/presets Python example using the OpenAI client with base_url https://api.routeway.ai/v1 and the ROUTEWAY_API_KEY environment variable. The preset ID is passed as the model parameter. ```python import os from openai import OpenAI client = OpenAI( base_url="https://api.routeway.ai/v1", api_key=os.getenv("ROUTEWAY_API_KEY") ) response = client.chat.completions.create( model="presets/0ede00c3-b202-4102-bda7-ec9a4b398767", messages=[ {"role": "user", "content": "hi"} ], ) print(response.choices[0].message.content) ``` -------------------------------- ### GET /v1/account/balance Source: https://docs.routeway.ai/api-reference/overview Retrieves the current credit balance for the authenticated account. ```APIDOC ## GET /v1/account/balance ### Description Retrieve your current credit balance. ### Method GET ### Endpoint /v1/account/balance ### Authentication Authorization: Bearer YOUR_ROUTEWAY_API_KEY ### Response #### Success Response (200) - **balance** (number) - Current credit balance #### Response Example { "balance": 100.00 } ``` -------------------------------- ### Successful Response JSON Example Source: https://docs.routeway.ai/core-concepts/responses/request-and-response Example of a successful API response in JSON format. Shows the response object with fields like id, object, created_at, model, status, output, output_text, and usage. The output array contains a message item with role 'assistant' and content of type 'output_text'. ```json { "id": "resp_abc123", "object": "response", "created_at": 1749052800, "model": "gpt-4o-2024-11-20", "status": "completed", "output": [ { "type": "message", "id": "msg_abc123", "role": "assistant", "content": [ { "type": "output_text", "text": "DNS (Domain Name System) translates human-readable domain names into IP addresses..." } ] } ], "output_text": "DNS (Domain Name System) translates human-readable domain names into IP addresses...", "usage": { "input_tokens": 35, "output_tokens": 62, "total_tokens": 97 } } ``` -------------------------------- ### Create a response with Python Source: https://docs.routeway.ai/core-concepts/responses/overview Initializes the OpenAI client with Routeway's base URL and creates a text generation request. ```python import os from openai import OpenAI client = OpenAI( base_url="https://api.routeway.ai/v1", api_key=os.getenv("ROUTEWAY_API_KEY") ) response = client.responses.create( model="gpt-4o", input="What is the capital of France?" ) print(response.output_text) ``` -------------------------------- ### Create a response with the Responses API Source: https://docs.routeway.ai/api-reference/Responses/responses Create a response using the Responses API. The Python and Node.js examples use the OpenAI SDK with a custom base URL and API key from the ROUTEWAY_API_KEY environment variable. The cURL example sends a POST request to /v1/responses with the model and input in the JSON body. ```python import os from openai import OpenAI client = OpenAI( base_url="https://api.routeway.ai/v1", api_key=os.getenv("ROUTEWAY_API_KEY") ) response = client.responses.create( model="gpt-4o", input="What is the capital of France?" ) print(response.output_text) ``` ```javascript import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.routeway.ai/v1", apiKey: process.env.ROUTEWAY_API_KEY, }); const response = await client.responses.create({ model: "gpt-4o", input: "What is the capital of France?", }); console.log(response.output_text); ``` ```bash curl https://api.routeway.ai/v1/responses \ -H "Authorization: Bearer $ROUTEWAY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4o", "input": "What is the capital of France?" }' ``` -------------------------------- ### Enable Web Search via cURL Source: https://docs.routeway.ai/core-concepts/responses/built-in-tools Use the web_search_preview tool to allow the model to search for current information. ```bash curl https://api.routeway.ai/v1/responses \ -H "Authorization: Bearer $ROUTEWAY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4o", "tools": [{"type": "web_search_preview"}], "input": "What were the top tech news stories today?" }' ``` -------------------------------- ### Node.js: Create a response with OpenAI client Source: https://docs.routeway.ai/core-concepts/responses/request-and-response Use the OpenAI Node.js client with baseURL set to https://api.routeway.ai/v1 and the ROUTEWAY_API_KEY environment variable. Creates a response with model gpt-4o, instructions, input, max_output_tokens, and temperature, then logs response.output_text. ```javascript import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.routeway.ai/v1", apiKey: process.env.ROUTEWAY_API_KEY, }); const response = await client.responses.create({ model: "gpt-4o", instructions: "You are a concise assistant. Reply in one paragraph.", input: "Explain how DNS works.", max_output_tokens: 200, temperature: 0.3, }); console.log(response.output_text); ``` -------------------------------- ### Stream responses with a preset Source: https://docs.routeway.ai/guides/chat-completions/presets Presets work with all standard Chat Completions parameters, including stream. This example streams the response and prints each content chunk as it arrives. ```python stream = client.chat.completions.create( model="presets/0ede00c3-b202-4102-bda7-ec9a4b398767", messages=[ {"role": "user", "content": "Tell me a short story."} ], stream=True, ) for chunk in stream: if chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="", flush=True) ``` -------------------------------- ### Initialize Routeway with JavaScript/TypeScript OpenAI SDK Source: https://docs.routeway.ai/integrations/other Configure the OpenAI JavaScript client by providing the Routeway baseURL. ```javascript import OpenAI from 'openai'; const client = new OpenAI({ apiKey: 'YOUR_ROUTEWAY_API_KEY', baseURL: 'https://api.routeway.ai/v1', }); const response = await client.chat.completions.create({ model: 'gpt-4.1', messages: [{ role: 'user', content: 'Hello!' }], }); ``` -------------------------------- ### API Error Response Source: https://docs.routeway.ai/api-reference/ImageEdits/edits Example of an error response returned by the API when a request fails. ```json { "error": { "message": "Invalid image format", "type": "invalid_request_error", "code": 400 } } ``` -------------------------------- ### GET /v1/account/keys Source: https://docs.routeway.ai/account-management/api-key-management Lists all API keys for the account. Requires a management key for authentication. ```APIDOC ## GET /v1/account/keys ### Description Returns all API keys for your account with masked values. ### Method GET ### Endpoint https://api.routeway.ai/v1/account/keys ### Parameters #### Headers - **Authorization** (string) - Required - Bearer token with a management key. ### Response #### Success Response (200) - **data** (array) - List of API key objects. - **api_key_id** (integer) - Unique identifier for the key. - **key** (string) - Masked key value (e.g., `rw-abc1234...5678`). - **label** (string) - Human-readable label for the key. - **daily_limit** (integer) - Daily spending limit for the key. - **created_at** (string) - ISO 8601 timestamp of key creation. #### Response Example ```json { "data": [ { "api_key_id": 1, "key": "rw-abc1234...5678", "label": "production", "daily_limit": 1000, "created_at": "2025-06-01T00:00:00Z" }, { "api_key_id": 2, "key": "rw-def5678...9012", "label": "staging", "daily_limit": 100, "created_at": "2025-06-10T00:00:00Z" } ] } ``` ``` -------------------------------- ### GET /v1/account/balance Source: https://docs.routeway.ai/account-management/overview Retrieves the current account balance. Requires a management key for authentication. ```APIDOC ## GET /v1/account/balance ### Description Retrieves the current account balance. ### Method GET ### Endpoint https://api.routeway.ai/v1/account/balance ### Authentication Requires a management key. Include it in the Authorization header as a Bearer token. ### Request Example ```bash curl https://api.routeway.ai/v1/account/balance \ -H "Authorization: Bearer $ROUTEWAY_MANAGEMENT_KEY" ``` ### Response #### Success Response (200) - **balance** (number) - The current account balance in dollars. #### Response Example ```json { "balance": 4.20 } ``` ``` -------------------------------- ### Create a response with Node.js Source: https://docs.routeway.ai/core-concepts/responses/overview Initializes the OpenAI client for Node.js and performs an asynchronous text generation request. ```javascript import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.routeway.ai/v1", apiKey: process.env.ROUTEWAY_API_KEY, }); const response = await client.responses.create({ model: "gpt-4o", input: "What is the capital of France?", }); console.log(response.output_text); ```