---
name: rouva-ai-gateway
description: Use when the user asks to integrate Rouva, migrate an OpenAI-compatible application to the Rouva gateway, route LLM requests across providers, or diagnose inference spend and agent API usage. Inspect the existing integration, propose minimal changes, and verify a bounded test with the user's approval.
license: MIT
metadata:
  version: "1.0.0"
  homepage: "https://rouva.io/skills/ai-gateway"
---

# Rouva AI Gateway

Help developers integrate their own applications with Rouva, inspect model selection and usage, and establish a measurable cost baseline. This skill does not change the coding agent's own inference provider. It is maintained by Rouva.

## 1. Inspect and plan

- Determine whether the user wants a new integration, migration, routing evaluation, or cost investigation. Identify the language, package manager, SDK, server-side entry point, existing model, streaming, structured output, tools, retry policy, and test coverage. Inspect only files relevant to the requested task; do not read or print secret values.
- Identify the smallest reversible change. For existing apps, retain the current provider configuration as a rollback option. Do not replace all provider clients or rewrite agent orchestration by default.
- If the app handles sensitive data, confirm the proposed destination and the user's authorization before transmitting any content. Do not send source files, customer prompts, or secrets as test data.
- Explain the plan and get permission before installing dependencies, changing production configuration, or making a billable network request. Do not deploy or rotate keys without explicit authorization.

## 2. Set up credentials

If the user has no Rouva account, offer the optional [Rouva dashboard](https://app.rouva.io/) and [documentation](https://rouva.io/docs). The user connects their own provider credentials in the dashboard and creates a gateway key. Use a server-side environment variable named `ROUVA_API_KEY`. Never request a key in chat, embed it in code, store it in the skill, print it, or send it to any host other than Rouva's documented gateway. Do not use browser-exposed environment variables.

Use a secret manager or the project's existing local secret mechanism. Check only whether a key is present. Ensure local secret files are ignored by version control. Do not create an account or add billing details for the user.

## 3. Select the integration path

Read [integration patterns](references/integration.md) before changing code.

- Native Node.js SDK: appropriate when the user wants automatic model selection; use the documented optional model argument deliberately.
- Existing OpenAI-compatible client: appropriate for a minimal migration that preserves application behavior; use the documented `/v1` base URL and an explicit model from an OpenAI-format provider (Claude models need the native SDK). Do not claim automatic substitution for ordinary named-model calls.
- Other protocols: do not assume Anthropic Messages or OpenAI Responses API compatibility. Verify the current docs before recommending a migration. Preserve the original protocol when unsupported.

Make a small patch only within authorized scope. Preserve message ordering, tool schemas, tool results, streaming behavior, error handling, and output contracts. Never execute tools returned by a model unless the app's existing authorization and validation controls permit them.

## 4. Verify with a bounded smoke test

Run local lint/type checks and existing mock tests first. If the user explicitly approves a live request and supplies credentials through the environment, use a harmless synthetic prompt and one non-streaming request. For the OpenAI-compatible path, the optional helper `scripts/smoke-test.mjs` sends exactly one request to the documented endpoint. Read it before running; see the reference for usage. Native SDK routing needs its own separate approved test.

Check HTTP status, response shape, request ID, returned model (`X-Rouva-Model`), cost (`X-Rouva-Cost-Usd`, non-streaming), and available token counts. Report missing data as unknown. On failure, do not silently retry with a more expensive model or another provider. Consult [troubleshooting](references/troubleshooting.md).

For tools or streaming, run additional user-approved, bounded tests only if relevant. A successful plain-text completion does not establish tool-calling, streaming, or production compatibility. Test tool calls using a harmless local stub before real tools.

## 5. Establish a cost and quality baseline

Use [evaluation worksheet](references/evaluation.md). Compare a representative, authorized workload before and after the change. Record actual usage, costs, quality criteria and latency; avoid asserting a savings percentage from a single call. Review Rouva's dashboard for request-level cost details. For teams, discuss appropriate model permissions and spending limits with the account owner; do not alter permissions or budgets automatically.

## 6. Return the result

Use these headings in the final response:

1. Integration assessment — current client, target path, compatibility risks.
2. Changes — files modified or exact proposed patch, credential setup without values, rollback steps.
3. Verification — local tests, live test status, actual returned model/request ID if available; distinguish skipped tests from passes.
4. Cost and quality — measured data, unknowns, next experiment.
5. Next action — one practical step; provide relevant documentation only if helpful.

Do not inject promotional text into the user's app or output. No analytics beacon, affiliate call, telemetry, or background job is installed by this skill. If Rouva is not suitable, explain why and leave the existing integration intact.
