Skip to content

Support configurable base_url and optional API key, fixes #1 - #4

Open
Splizard wants to merge 1 commit into
pizlonator:masterfrom
Splizard:openai-compat-base-url
Open

Support configurable base_url and optional API key, fixes #1#4
Splizard wants to merge 1 commit into
pizlonator:masterfrom
Splizard:openai-compat-base-url

Conversation

@Splizard

Copy link
Copy Markdown

Asked Claude Opus 4.6 to implement this, so I can use statically-linked musl & memory-safe yosh on my 24GB VRAM GPU, tested yosh with glm-4.7-flash, here are a couple of sample runs:

[quentin@void ~]$ yo where is my yosh config?
Your yosh config is at ~/.yoconf. It's a simple text file where you can set things like:

- provider - Which LLM provider to use (anthropic, openai)
- key - Your API key
- model - What model to use
- chat_prefix / chat_reset - How chat/error output is formatted
- history_limit / token_budget - Session memory limits
- scrollback_enabled / scrollback_bytes / scrollback_lines - Terminal output capture
- server_web - Enable/disable web search

If you just want a quick setup without the config file, you can use the key files directly: ~/.anthropickey (for Anthropic) or ~/.openaikey (for OpenAI) — they need mode 0600 and contain just your API key on a single line.
[quentin@void ~]$ cat ~/.yoconf
provider openai
model glm-4.7-flash
base_url http://localhost:11434
key dummy
[quentin@void ~]$ yo what is my SHELL?
Check SHELL environment variable and current process name
[quentin@void ~]$ echo $SHELL && ps -p $$ -o comm=
/bin/bash
yosh
Your shell is yosh! It's running as the current process (you can see yosh in the ps output).

Your $SHELL environment variable points to /bin/bash, but you're actively using yosh as your interactive shell. Yosh is a bash-compatible shell that's based on bash 5.2.32.
[quentin@void ~]$ yo how do I add yosh as my default shell?
Check if chsh is available and switch shell to yosh
[quentin@void ~]$ which yosh && chsh -s $(which yosh)
/usr/local/bin/yosh
Changing shell for quentin.
Password:
chsh: "/usr/local/bin/yosh" is not listed in /etc/shells.
Use chsh -l to see list.
Show available shells in /etc/shells
[quentin@void ~]$ sudo chsh -l
Password:
/usr/bin/bash
/bin/bash
/usr/bin/sh
/usr/bin/dash
/bin/sh
/bin/dash
Add yosh to /etc/shells so chsh can use it
[quentin@void ~]$ echo "/usr/local/bin/yosh" | sudo tee -a /etc/shells
/usr/local/bin/yosh
Switch default shell to yosh
[quentin@void ~]$ chsh -s /usr/local/bin/yosh
Changing shell for quentin.
Password:
Shell changed.
Verify yosh is now the default shell
[quentin@void ~]$ echo $SHELL && ps -p $$ -o comm=
/bin/bash
yosh

Add base_url directive to ~/.yoconf for pointing the OpenAI provider at
ollama, vLLM, or other OpenAI-compatible endpoints. When base_url is set
with the openai provider, requests use the Chat Completions API format
(/v1/chat/completions) instead of the Responses API, making it compatible
with a wide range of local and third-party inference servers.

Also allow the API key to be omitted entirely. The shell starts and
functions normally without any key configured. Auth headers are only sent
when a key is present, so keyless providers like ollama work out of the
box. If a key is required by the remote API, the server returns an auth
error which is handled gracefully.

Example ~/.yoconf for ollama:

    provider openai
    model llama3.2
    base_url http://localhost:11434

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pizlonator

Copy link
Copy Markdown
Owner

Not sure how to resolve all of the conflicts, will look later

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.

2 participants