rig-core-v0.38.0
0xPlaygrounds/rigrig-core-v0.38.0Jun 2, 2026by github-actions[bot]
AI Summary
Adds token usage reporting to embeddings, introduces prompt caching for OpenRouter, and exposes streaming metadata across providers.
Key Highlights
- Expose token usage via embed_texts_with_usage
- OpenRouter prompt caching support
- Streaming response metadata for Gemini
New Features
- Token usage in embeddings
- OpenRouter prompt caching
- Streaming response metadata
- Tool call delta in prompt request
- Document citations support
Full Release Notes
### Added - *(rig-derive)* replace hand-rolled schema with schemars in #[rig_tool] ([#1576](https://github.com/0xPlaygrounds/rig/pull/1576)) (by @tomasz-feliksik) - *(embeddings)* expose token usage via embed_texts_with_usage ([#1791](https://github.com/0xPlaygrounds/rig/pull/1791)) (by @sergiomeneses) - *(openrouter)* add prompt-caching support ([#1832](https://github.com/0xPlaygrounds/rig/pull/1832)) (by @gold-silver-copper) - *(openrouter)* add with_app_identity and with_app_categories builders for app attribution ([#1806](https://github.com/0xPlaygrounds/rig/pull/1806)) (by @jimmiebfulton) - *(openrouter)* surface cache token accounting in Usage ([#1808](https://github.com/0xPlaygrounds/rig/pull/1808)) (by @jimmiebfulton) - *(gemini)* expose streaming response metadata ([#1790](https://github.com/0xPlaygrounds/rig/pull/1790)) (by @mateobelanger) - *(anthropic)* support document citations ([#1778](https://github.com/0xPlaygrounds/rig/pull/1778)) (by @temrjan) - *(gemini)* expose finish_reason and model_version on StreamingCompletionResponse ([#1776](https://github.com/0xPlaygrounds/rig/pull/1776)) (by @mateobelanger) ### Fixed - *(openai)* tolerate object-form tool-call `arguments` in streaming ([#1822](https://github.com/0xPlaygrounds/rig/pull/1822)) (by @xavierforge) - *(chatgpt)* Handle ChatGPT response.completed events without output field ([#1825](https://github.com/0xPlaygrounds/rig/pull/1825)) (by @geraschenko) - *(rig-core)* Expose tools added via ToolServerHandle::append_toolset ([#1837](https://github.com/0xPlaygrounds/rig/pull/1837)) (by @mccormickt) - avoid duplicate streaming reasoning history ([#1849](https://github.com/0xPlaygrounds/rig/pull/1849)) (by @gold-silver-copper) - #1849 - *(rig-gemini-grpc)* populate FunctionDeclaration.parameters from ToolDefinition ([#1763](https://github.com/0xPlaygrounds/rig/pull/1763)) (by @abhicris) - *(openrouter)* avoid replaying generated images ([#1835](https://github.com/0xPlaygrounds/rig/pull/1835)) (by @gold-silver-copper) - *(openrouter)* accept Gemini model role responses ([#1800](https://github.com/0xPlaygrounds/rig/pull/1800)) (by @puneetdixit200) - *(tools)* safely normalize null tool call arguments ([#1814](https://github.com/0xPlaygrounds/rig/pull/1814)) (by @gold-silver-copper) - *(ollama)* buffer NDJSON streaming across HTTP chunk boundaries bytes_stream may split a single NDJSON line across chunks, causing serde_json::from_slice to fail mid-stream with an EOF error on longer assistant messages ([#1759](https://github.com/0xPlaygrounds/rig/pull/1759)) (by @ChadBartley) - *(gemini)* record tool use prompt token telemetry ([#1799](https://github.com/0xPlaygrounds/rig/pull/1799)) (by @gold-silver-copper) - default OpenAI base64 image detail ([#1781](https://github.com/0xPlaygrounds/rig/pull/1781)) (by @fangkangmi) - #1781 - stream ToolCallDelta in prompt_request ([#1789](https://github.com/0xPlaygrounds/rig/pull/1789)) (by @notV4l) - #1789 - fix sqlite threshold and null tool call streaming ([#1786](https://github.com/0xPlaygrounds/rig/pull/1786)) (by @gold-silver-copper) - #1786 - *(anthropic)* serialize ToolResultContent::Image with source wrapper ([#1772](https://github.com/0xPlaygrounds/rig/pull/1772)) (by @Cyanistic) ### Other - Fix parsing of streamed function-call argument deltas ([#1828](https://github.com/0xPlaygrounds/rig/pull/1828)) (by @geraschenko) - #1828 - Add invalid tool call recovery hooks ([#1840](https://github.com/0xPlaygrounds/rig/pull/1840)) (by @gold-silver-copper) - #1840 - [codex] Validate model tool calls ([#1823](https://github.com/0xPlaygrounds/rig/pull/1823)) (by @gold-silver-copper) - #1823 - Cap OpenRouter app categories header ([#1821](https://github.com/0xPlaygrounds/rig/pull/1821)) (by @gold-silver-copper) - #1821 - [codex] apply Anthropic cache control to tools ([#1815](https://github.com/0xPlaygrounds/rig/pull/1815)) (by @gold-silver-copper) - #1815 - Expose per-completion-call usage in agent responses ([#1787](https://github.com/0xPlaygrounds/rig/pull/1787)) (by @gold-silver-copper) - #1787 - Add replayable provider cassette tests ([#1769](https://github.com/0xPlaygrounds/rig/pull/1769)) (by @gold-silver-copper) - #1769 ### Contributors * @xavierforge * @geraschenko * @mccormickt * @gold-silver-copper * @tomasz-feliksik * @sergiomeneses * @abhicris * @jimmiebfulton * @puneetdixit200 * @ChadBartley * @mateobelanger * @temrjan * @fangkangmi * @notV4l * @Cyanistic