Skip to content

Commit 5a8cd13

Browse files
committed
version 0.1.2; cargo fmt; fix models pricing
1 parent 8315508 commit 5a8cd13

4 files changed

Lines changed: 12 additions & 20 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
![](https://github.com/alexylon/sofos-code/actions/workflows/rust.yml/badge.svg)
44

5-
A blazingly fast, interactive AI coding assistant powered by Claude or OpenAI, implemented in pure Rust, that can generate code, edit files, and search the web - all from your terminal.
5+
A blazingly fast, interactive AI coding assistant powered by Claude or GPT, implemented in pure Rust, that can generate code, edit files, and search the web - all from your terminal.
66

77
<div align="center"><img src="/assets/sofos_code.png" style="width: 800px;" alt="Sofos Code"></div>
88

99
## Features
1010

11-
- **Interactive REPL** - Multi-turn conversations with Claude or OpenAI
11+
- **Interactive REPL** - Multi-turn conversations with Claude or GPT
1212
- **Session History** - Automatic session saving and resume previous conversations
1313
- **Custom Instructions** - Project and personal instruction files for context-aware assistance
1414
- **File Operations** - Read, write, list, and create files/directories (sandboxed to current directory)
@@ -17,7 +17,7 @@ A blazingly fast, interactive AI coding assistant powered by Claude or OpenAI, i
1717
- **Web Search** - Real-time web information via Claude's native search tool
1818
- **Bash Execution** - Run tests and build commands safely (read-only, sandboxed)
1919
- **Visual Diff Display** - See exactly what changed with colored diffs (red for deletions, blue for additions)
20-
- **Iterative Tool Execution** - Claude can use up to 200 tools per request for complex multi-file operations
20+
- **Iterative Tool Execution** - Sofos can use up to 200 tools per request for complex multi-file operations
2121
- **Session Usage** – After exiting Sofos, a session usage is displayed, including the input and output tokens used and the estimated cost.
2222
- **Secure** - All operations restricted to workspace, prevents directory traversal
2323

@@ -103,7 +103,7 @@ Estimated cost: $0.1304
103103
**Cost Calculation:**
104104
- Costs are calculated based on official model pricing
105105
- Claude models use official Anthropic pricing (e.g., Sonnet 4.5: $3/$15 per million input/output tokens)
106-
- OpenAI models use estimated pricing ($5/$15 per million tokens for gpt-5.1-codex models)
106+
- OpenAI models use official OpenAI pricing ($1.25/$10 per million tokens for gpt-5.1-codex and gpt-5.1-codex-max models)
107107
- Accurate for standard API usage
108108

109109
### Options
@@ -249,7 +249,7 @@ MIT License
249249

250250
## Acknowledgments
251251

252-
Built with Rust and powered by Anthropic's Claude. Morph Apply integration for fast edits. Inspired by Aider and similar tools.
252+
Built with Rust and powered by Anthropic's Claude or OpenAI's GPT. Morph Apply integration for fast edits. Inspired by Aider and similar tools.
253253

254254
---
255255

src/api/openai.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use serde::Deserialize;
55
use serde_json::json;
66
use std::time::Duration;
77

8-
// OpenAI responses API (for gpt-5.1-codex) and chat completions (for other chat models)
8+
// OpenAI responses API (for gpt-5.1-codex-max) and chat completions (for other chat models)
99
const OPENAI_API_BASE: &str = "https://api.openai.com/v1";
1010
const REQUEST_TIMEOUT: Duration = super::anthropic::REQUEST_TIMEOUT;
1111

@@ -37,7 +37,7 @@ impl OpenAIClient {
3737
&self,
3838
request: CreateMessageRequest,
3939
) -> Result<CreateMessageResponse> {
40-
// gpt-5.1-codex uses the /responses endpoint with `input`
40+
// gpt-5.1-codex-max uses the /responses endpoint with `input`
4141
if request.model.contains("gpt-5.1-codex") {
4242
return self.call_responses(request).await;
4343
}

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn main() -> Result<()> {
4848
eprintln!("Please set your OpenAI API key:");
4949
eprintln!(" export OPENAI_API_KEY='your-api-key'");
5050
eprintln!("Or use the --openai-api-key flag:");
51-
eprintln!(" sofos --openai-api-key 'your-api-key' --model gpt-5.1-codex");
51+
eprintln!(" sofos --openai-api-key 'your-api-key' --model gpt-5.1-codex-max");
5252
std::process::exit(1);
5353
}
5454
}

src/ui.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -304,18 +304,10 @@ impl UI {
304304
fn calculate_cost(model: &str, input_tokens: u32, output_tokens: u32) -> f64 {
305305
// Prices per million tokens in USD
306306
let (input_price, output_price) = match model {
307-
"claude-sonnet-4-5" | "claude-sonnet-4.5" => (3.0, 15.0),
308-
"claude-haiku-4-5" | "claude-haiku-4.5" => (0.8, 4.0),
309-
"claude-sonnet-4" | "claude-4-sonnet-20250514" => (3.0, 15.0),
310-
"claude-opus-4" | "claude-4-opus-20250514" => (15.0, 75.0),
311-
"claude-opus-4.1" | "claude-opus-4-1" => (6.0, 30.0),
312-
"claude-sonnet-3-7" | "claude-sonnet-3.7" => (3.0, 15.0),
313-
"claude-sonnet-3-5" | "claude-sonnet-3.5" => (3.0, 15.0),
314-
"claude-haiku-3-5" | "claude-haiku-3.5" => (0.8, 4.0),
315-
"claude-opus-3" | "claude-3-opus-20240229" => (15.0, 75.0),
316-
"claude-sonnet-3" | "claude-3-sonnet-20240229" => (3.0, 15.0),
317-
"claude-haiku-3" | "claude-3-haiku-20240307" => (0.25, 1.25),
318-
"gpt-5.1-codex" => (5.0, 15.0),
307+
"claude-sonnet-4-5" => (3.0, 15.0),
308+
"claude-opus-4-5" => (5.0, 25.0),
309+
"claude-haiku-4-5" => (1.0, 5.0),
310+
"gpt-5.1-codex-max" | "gpt-5.1-codex" | "gpt-5-codex" => (1.25, 10.0),
319311
// Default fallback (use Sonnet 4.5 pricing)
320312
_ => (3.0, 15.0),
321313
};

0 commit comments

Comments
 (0)