Skip to content

Clarify Prime Inference OpenAI auth setup#735

Open
d42me wants to merge 3 commits into
mainfrom
improvement/prime-inference-library-auth
Open

Clarify Prime Inference OpenAI auth setup#735
d42me wants to merge 3 commits into
mainfrom
improvement/prime-inference-library-auth

Conversation

@d42me

@d42me d42me commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a tiny prime package export so examples can use from prime import Config
  • expose Config.inference_headers for OpenAI default_headers, including active team context via X-Prime-Team-ID
  • update docs/examples to prefer prime login / active config and process-scoped PRIME_API_KEY overrides

Tests

  • exact OpenAI snippet with from prime import Config
  • exact OpenAI snippet with default_headers=prime.inference_headers
  • built wheel install + exact OpenAI snippet with process-scoped PRIME_API_KEY
  • built wheel install + team-header snippet with process-scoped PRIME_TEAM_ID
  • PRIME_TEAM_ID=ci-team uv run pytest packages/prime/tests/test_inference_config.py -q
  • uv run ruff check packages/prime/src/prime packages/prime/src/prime_cli/core/config.py packages/prime/tests/test_inference_config.py packages/prime-evals/examples/basic_usage.py packages/prime-sandboxes/examples/basic_usage.py packages/prime-sandboxes/examples/async_background.py

How it works now

Library code can use Prime Inference with the standard OpenAI client and the active prime login context:

from openai import OpenAI
from prime import Config

prime = Config()
client = OpenAI(
    base_url=prime.inference_url,
    api_key=prime.api_key,
    default_headers=prime.inference_headers,
)

prime.inference_headers exposes the active team context as OpenAI default_headers (X-Prime-Team-ID) when a team is selected via prime switch or PRIME_TEAM_ID. PRIME_API_KEY still works, but as an explicit per-process/project override rather than something users need to export globally.


Note

Low Risk
Small additive SDK surface and documentation; inference headers only attach team context when configured, with unit tests.

Overview
Adds a prime Python package that re-exports Config so apps can use from prime import Config, and adds Config.inference_headers for OpenAI-compatible Prime Inference clients ( X-Prime-Team-ID from active team / PRIME_TEAM_ID ).

Docs and examples now steer users toward prime login / active config and process-scoped PRIME_API_KEY instead of global exports or inline API keys, including new OpenAI + Config snippets in the root and packages/prime READMEs. pyproject.toml includes src/prime in the wheel; tests cover the export and inference header behavior.

Reviewed by Cursor Bugbot for commit e967f2b. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread packages/prime/src/prime/__init__.py Outdated
@d42me d42me force-pushed the improvement/prime-inference-library-auth branch from 20d9db7 to e3a8b69 Compare June 9, 2026 03:16

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e3a8b69. Configure here.

Comment thread packages/prime/README.md Outdated
@d42me d42me changed the title Add Prime inference SDK auth helper Clarify Prime Inference OpenAI auth setup Jun 9, 2026
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.

1 participant