@rouvanpm/rouva 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/index.d.mts +25 -0
- package/dist/index.d.ts +25 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -86,15 +86,32 @@ Streaming responses are normalized to OpenAI-style SSE chunks, even when Rouva r
|
|
|
86
86
|
|
|
87
87
|
```typescript
|
|
88
88
|
const res = await rouva.chat.completions.create({
|
|
89
|
+
model: 'gpt-4o-mini', // required when using seed (OpenAI only)
|
|
89
90
|
messages: [{ role: 'user', content: 'Write a haiku about routing.' }],
|
|
90
91
|
system: 'You are a concise assistant.', // string or Anthropic-style text blocks
|
|
91
92
|
max_tokens: 1024, // default 4096
|
|
92
93
|
temperature: 0.7, // 0–1
|
|
94
|
+
top_p: 0.9, // nucleus sampling, (0, 1]
|
|
95
|
+
stop: ['END'], // up to 4 stop sequences
|
|
96
|
+
seed: 42, // pins the request to this exact model
|
|
93
97
|
})
|
|
94
98
|
```
|
|
95
99
|
|
|
96
100
|
- **`temperature`** — sampling temperature between 0 and 1. Reasoning models (the gpt-5 family) only support their default temperature, so the gateway omits it when routing to one.
|
|
97
101
|
- **`max_tokens`** — values below 1024 also steer auto-routing away from reasoning models, which would otherwise spend the whole budget on hidden reasoning tokens.
|
|
102
|
+
- **`top_p`** — nucleus sampling, forwarded to every provider; `top_p: 1` is treated as omitted. OpenAI reasoning models don't support it: auto-routing avoids them when it's set, and pinning one returns a 400.
|
|
103
|
+
- **`stop`** — a string or up to 4 stop sequences, forwarded to every provider (Anthropic receives them as `stop_sequences`).
|
|
104
|
+
- **`seed`** — best-effort deterministic sampling. Only OpenAI honors it, so it requires an OpenAI `model` and pins the request to that exact model (no routing, no fallbacks).
|
|
105
|
+
|
|
106
|
+
Unsupported OpenAI options (`response_format`, `logit_bias`, `n > 1`, the legacy `functions`/`function_call` fields, …) are rejected by the gateway with an explicit 400 rather than silently ignored.
|
|
107
|
+
|
|
108
|
+
## Unlisted models
|
|
109
|
+
|
|
110
|
+
Model IDs beyond the typed union also work when pinned — dated snapshots (`gpt-4o-mini-2024-07-18`), fine-tunes (`ft:gpt-4o-mini:…`), and newly released models are matched to their provider by naming convention and forwarded as-is. Until the gateway's pricing registry knows them, the dashboard records their token counts with zero cost.
|
|
111
|
+
|
|
112
|
+
## OpenAI-compatible endpoint
|
|
113
|
+
|
|
114
|
+
Using the OpenAI SDK (or LangChain, the Vercel AI SDK, …) instead of this one? The gateway is also served at `POST /v1/chat/completions` — point `baseURL` at `https://app.rouva.io/v1` with your `rva_` key and it behaves exactly like OpenAI: `model` is required and always honored (no substitution), responses are buffered JSON unless `stream: true`, and only OpenAI-format providers are available (use this SDK or the native endpoint for Anthropic models). Intelligent routing applies only to the native endpoint used by this SDK.
|
|
98
115
|
|
|
99
116
|
## Tool use
|
|
100
117
|
|
package/dist/index.d.mts
CHANGED
|
@@ -49,6 +49,12 @@ type RouvaProvider = 'anthropic' | 'openai' | 'gemini' | 'deepseek' | 'mistral'
|
|
|
49
49
|
/**
|
|
50
50
|
* Supported models across all providers.
|
|
51
51
|
* Omit `model` entirely to let Rouva route to the cheapest capable model automatically.
|
|
52
|
+
*
|
|
53
|
+
* IDs not listed here also work when pinned — dated snapshots
|
|
54
|
+
* (`gpt-4o-mini-2024-07-18`), fine-tunes (`ft:gpt-4o-mini:…`), and new
|
|
55
|
+
* releases are matched to their provider by naming convention and forwarded
|
|
56
|
+
* as-is. Until the gateway's registry knows their pricing, such requests are
|
|
57
|
+
* logged with token counts but zero cost.
|
|
52
58
|
*/
|
|
53
59
|
type RouvaModel = 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-sonnet-4-6' | 'claude-sonnet-5' | 'claude-haiku-4-5-20251001' | 'claude-fable-5' | 'gpt-5-nano' | 'gpt-5-mini' | 'gpt-5' | 'gpt-5.6' | 'gpt-4.1-nano' | 'gpt-4.1-mini' | 'gpt-4.1' | 'gpt-4o' | 'gpt-4o-mini' | 'gemini-2.5-flash' | 'gemini-2.5-pro' | 'deepseek-v4-flash' | 'deepseek-v4-flash-think' | 'deepseek-v4-pro' | 'mistral-small-latest' | 'mistral-large-latest' | 'kimi-k2.6' | 'grok-4.3' | 'grok-4.20-0309-reasoning' | 'grok-4.5' | 'glm-4.7-flash' | 'glm-5.2' | (string & {});
|
|
54
60
|
/** Anthropic-style text block — the array form of the `system` param */
|
|
@@ -83,6 +89,25 @@ interface ChatCompletionParams {
|
|
|
83
89
|
* temperature, so the gateway omits it for those.
|
|
84
90
|
*/
|
|
85
91
|
temperature?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Nucleus sampling — greater than 0 and at most 1, forwarded to every
|
|
94
|
+
* provider. `top_p: 1` (the no-op default) is treated as omitted. OpenAI
|
|
95
|
+
* reasoning models (gpt-5 family, o-series) don't support it: auto-routing
|
|
96
|
+
* avoids them when top_p is set, and pinning one returns a 400.
|
|
97
|
+
*/
|
|
98
|
+
top_p?: number;
|
|
99
|
+
/**
|
|
100
|
+
* Up to 4 stop sequences — a string or array of non-empty strings,
|
|
101
|
+
* forwarded to every provider (Anthropic receives them as
|
|
102
|
+
* `stop_sequences`).
|
|
103
|
+
*/
|
|
104
|
+
stop?: string | string[];
|
|
105
|
+
/**
|
|
106
|
+
* Best-effort deterministic sampling. Only OpenAI honors it, so it
|
|
107
|
+
* requires an OpenAI `model` and pins the request to that exact model —
|
|
108
|
+
* no cheaper-model substitution, no cross-provider fallbacks.
|
|
109
|
+
*/
|
|
110
|
+
seed?: number;
|
|
86
111
|
/**
|
|
87
112
|
* Stream the response. Client-side only — controls whether `create()`
|
|
88
113
|
* returns a ReadableStream or a buffered ChatCompletion; never sent to
|
package/dist/index.d.ts
CHANGED
|
@@ -49,6 +49,12 @@ type RouvaProvider = 'anthropic' | 'openai' | 'gemini' | 'deepseek' | 'mistral'
|
|
|
49
49
|
/**
|
|
50
50
|
* Supported models across all providers.
|
|
51
51
|
* Omit `model` entirely to let Rouva route to the cheapest capable model automatically.
|
|
52
|
+
*
|
|
53
|
+
* IDs not listed here also work when pinned — dated snapshots
|
|
54
|
+
* (`gpt-4o-mini-2024-07-18`), fine-tunes (`ft:gpt-4o-mini:…`), and new
|
|
55
|
+
* releases are matched to their provider by naming convention and forwarded
|
|
56
|
+
* as-is. Until the gateway's registry knows their pricing, such requests are
|
|
57
|
+
* logged with token counts but zero cost.
|
|
52
58
|
*/
|
|
53
59
|
type RouvaModel = 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-sonnet-4-6' | 'claude-sonnet-5' | 'claude-haiku-4-5-20251001' | 'claude-fable-5' | 'gpt-5-nano' | 'gpt-5-mini' | 'gpt-5' | 'gpt-5.6' | 'gpt-4.1-nano' | 'gpt-4.1-mini' | 'gpt-4.1' | 'gpt-4o' | 'gpt-4o-mini' | 'gemini-2.5-flash' | 'gemini-2.5-pro' | 'deepseek-v4-flash' | 'deepseek-v4-flash-think' | 'deepseek-v4-pro' | 'mistral-small-latest' | 'mistral-large-latest' | 'kimi-k2.6' | 'grok-4.3' | 'grok-4.20-0309-reasoning' | 'grok-4.5' | 'glm-4.7-flash' | 'glm-5.2' | (string & {});
|
|
54
60
|
/** Anthropic-style text block — the array form of the `system` param */
|
|
@@ -83,6 +89,25 @@ interface ChatCompletionParams {
|
|
|
83
89
|
* temperature, so the gateway omits it for those.
|
|
84
90
|
*/
|
|
85
91
|
temperature?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Nucleus sampling — greater than 0 and at most 1, forwarded to every
|
|
94
|
+
* provider. `top_p: 1` (the no-op default) is treated as omitted. OpenAI
|
|
95
|
+
* reasoning models (gpt-5 family, o-series) don't support it: auto-routing
|
|
96
|
+
* avoids them when top_p is set, and pinning one returns a 400.
|
|
97
|
+
*/
|
|
98
|
+
top_p?: number;
|
|
99
|
+
/**
|
|
100
|
+
* Up to 4 stop sequences — a string or array of non-empty strings,
|
|
101
|
+
* forwarded to every provider (Anthropic receives them as
|
|
102
|
+
* `stop_sequences`).
|
|
103
|
+
*/
|
|
104
|
+
stop?: string | string[];
|
|
105
|
+
/**
|
|
106
|
+
* Best-effort deterministic sampling. Only OpenAI honors it, so it
|
|
107
|
+
* requires an OpenAI `model` and pins the request to that exact model —
|
|
108
|
+
* no cheaper-model substitution, no cross-provider fallbacks.
|
|
109
|
+
*/
|
|
110
|
+
seed?: number;
|
|
86
111
|
/**
|
|
87
112
|
* Stream the response. Client-side only — controls whether `create()`
|
|
88
113
|
* returns a ReadableStream or a buffered ChatCompletion; never sent to
|
package/package.json
CHANGED