Skip to content

v0.3.0 — OpenAI-compatible APIs & MCP HTTP headers

Choose a tag to compare

@Ferdea Ferdea released this 04 Sep 18:13
· 7 commits to main since this release

What's new

OpenAI-compatible APIs (#20, #23) — OpenAIProvider now accepts
base_url, unlocking every provider that speaks the Chat Completions
protocol with a single adapter: cloud (OpenRouter, Groq, DeepSeek, Mistral,
Perplexity, xAI, Together, Fireworks) and local/self-hosted servers
(LM Studio, vLLM, LocalAI, Ollama).

from ember import Agent, OpenAIProvider                                        
                                                                               
# cloud provider (e.g. Groq)                                                   
agent = Agent(                                                                 
    provider=OpenAIProvider(                                                   
        api_key=os.environ["GROQ_API_KEY"],                                    
        base_url="https://api.groq.com/openai/v1",                             
        model="llama-3.1-8b-instant",                                          
    ),                                                                         
)                                                                              
                                                                               
# local server (e.g. LM Studio) — pass a dummy key                             
provider = OpenAIProvider(                                                     
    api_key="sk-local",                                                        
    base_url="http://localhost:1234/v1",                                       
    model="local-model",                                                       
)                                                                              
                                                                               

• New constructor parameter base_url: str | None = None — None keeps the       
  default OpenAI endpoint, so existing code is unaffected.                     
• base_url is the full API URL: the SDK appends /chat/completions itself,      
  nobody adds /v1 for you.                                                     
• api_key stays required; config is passed explicitly (nothing is read from env
  / .env).                                                                     
• Works with complete(), stream() and tool calling; also available via         
  get_provider("openai", api_key=..., base_url=...).                           

HTTP headers in MCPClient.http (#21, #22) — MCPClient.http(...) now accepts     
headers={...}, so you can connect to MCP servers protected by authentication    
(Bearer tokens, API keys, custom headers).                                      

                                                                               
from ember import MCPClient                                                    
                                                                               
with MCPClient.http(                                                           
    "https://mcp.example.com/mcp",                                             
    headers={"Authorization": "Bearer YOUR_TOKEN"},                            
) as mcp:                                                                      
    tools = mcp.list_tools()                                                   

• Headers are sent with every request of the session (session init, tools/list,
tools/call), not just the first one.
• stdio transport is unaffected (headers are ignored there).
• Fully backwards compatible: MCPClient.http(url) without headers works as
before.

Installation

pip install "emberio-labs-ember[openai]"   # OpenAI-compatible APIs            
pip install "emberio-labs-ember[mcp]"      # MCP client                        

Full Changelog: v0.2.0...v0.3.0
PyPI: https://pypi.org/project/emberio-labs-ember/0.3.0/