Skip to content

Conversation

@vigneshsubbiah16
Copy link

@vigneshsubbiah16 vigneshsubbiah16 commented Jan 10, 2026

Closes #7594

Adds Unbound as a provider to opencode. Docs: https://docs.getunbound.ai/

Changes:

  • Added Unbound to bundled providers with custom loader
  • Fetches available models dynamically from /models endpoint
  • Parses model capabilities, token limits, and pricing
  • Added X-Unbound-Metadata header for analytics
  • Added provider icon

Configuration:

export UNBOUND_API_KEY=your-api-key

Verification:

  • Tested opencode models lists Unbound models
  • Tested chat completions with multiple models (gpt-4o-mini, claude-3-5-haiku, claude-sonnet-4-5)
  • Added 10 unit tests covering all functionality

Post Merge: Add opencode support to the Unbound docs.

Add Unbound Security (https://getunbound.ai) as a first-class provider
for secure, compliant AI access through their AI Gateway.

Changes:
- Add Unbound provider definition with OpenAI-compatible API support
- Add custom loader that dynamically fetches available models from the gateway
- Add Unbound icon SVG
- Update provider icon types

Configuration:
- Set UNBOUND_API_KEY environment variable, or
- Use /connect command to authenticate, or
- Configure in opencode.json:
  {
    "provider": {
      "unbound": {
        "options": {
          "apiKey": "your-key",
          "baseURL": "https://api.getunbound.ai/v1"
        }
      }
    }
  }

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@vigneshsubbiah16 vigneshsubbiah16 marked this pull request as draft January 10, 2026 06:38
vigneshsubbiah16 and others added 5 commits January 9, 2026 23:15
- Use model.parameters.context_window and model.parameters.max_tokens
- Parse pricing data from model.pricing object
- Use conservative default of 4096 for max_tokens fallback

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Based on Roo-Code implementation reference:
- Add X-Unbound-Metadata header with app label for analytics tracking
- Support both nested (model.parameters) and flat field structures
- Detect prompt caching support from API response
- Support both snake_case and camelCase field names from API

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Cache Config.get() to avoid redundant async calls (performance)
- Add logging when models API returns non-OK response (debuggability)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Simplify custom loader with cleaner patterns (38 lines reduced)
- Use nullish coalescing (??) consistently
- Cache Config.get() to avoid redundant async calls
- Add 10 unit tests covering:
  - Loading from env variable and config
  - Custom baseURL configuration
  - Model fetching and parsing
  - Pricing data parsing
  - X-Unbound-Metadata header
  - API failure fallback
  - Env variable precedence
  - disabled_providers support

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@vigneshsubbiah16 vigneshsubbiah16 marked this pull request as ready for review January 10, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Unbound as a provider

1 participant