Ollama Turbo Support #1638

Closed
opened 2026-02-16 17:31:51 -05:00 by yindo · 35 comments
Owner

Originally created by @tnorlund on GitHub (Sep 6, 2025).

Originally assigned to: @thdxr on GitHub.

I'm trying to write a custom provider for the Ollama Turbo API. I can get a response from curl:

curl -s https://ollama.com/api/chat \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer $OLLAMA_API_KEY" \
     -d '{"model":"gpt-oss:20b","messages":[{"role":"user","content":"What is the capital of Brazil?"}],"stream":false}'

but when I use the exact endpoint and everything I still get an AI_APICalError. What do I need to change?

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ollama (turbo)",
      "options": {
        "baseURL": "https://ollama.com/api/chat",
        "headers": {
          "Authorization": "Bearer $OLLAMA_API_KEY"
        }
      },
      "models": {
        "gpt-oss:20b": {
          "name": "GPT-OSS 20B"
        },
        "gpt-oss:120b": {
          "name": "GPT-OSS 120B"
        }
      }
    }
  }
}
Originally created by @tnorlund on GitHub (Sep 6, 2025). Originally assigned to: @thdxr on GitHub. I'm trying to write a custom provider for the Ollama Turbo API. I can get a response from curl: ``` curl -s https://ollama.com/api/chat \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $OLLAMA_API_KEY" \ -d '{"model":"gpt-oss:20b","messages":[{"role":"user","content":"What is the capital of Brazil?"}],"stream":false}' ``` but when I use the exact endpoint and everything I still get an `AI_APICalError`. What do I need to change? ``` { "$schema": "https://opencode.ai/config.json", "provider": { "ollama": { "npm": "@ai-sdk/openai-compatible", "name": "Ollama (turbo)", "options": { "baseURL": "https://ollama.com/api/chat", "headers": { "Authorization": "Bearer $OLLAMA_API_KEY" } }, "models": { "gpt-oss:20b": { "name": "GPT-OSS 20B" }, "gpt-oss:120b": { "name": "GPT-OSS 120B" } } } } } ```
yindo closed this issue 2026-02-16 17:31:51 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 6, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #1555: LM Studio custom provider configuration issues with @ai-sdk/openai-compatible - similar configuration setup and provider not working
  • #1298: AI_TypeValidationError with custom openai-compatible provider - similar API validation errors when setting up custom providers
  • #1003: AI_APICallError with custom provider configuration - same type of API call error you're experiencing
  • #195: TypeError with LM Studio openai-compatible provider - similar baseURL and endpoint configuration issues
  • #971: Model options not forwarded for openai-compatible providers - may be related to your configuration not working properly

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Sep 6, 2025): This issue might be a duplicate of existing issues. Please check: - #1555: LM Studio custom provider configuration issues with @ai-sdk/openai-compatible - similar configuration setup and provider not working - #1298: AI_TypeValidationError with custom openai-compatible provider - similar API validation errors when setting up custom providers - #1003: AI_APICallError with custom provider configuration - same type of API call error you're experiencing - #195: TypeError with LM Studio openai-compatible provider - similar baseURL and endpoint configuration issues - #971: Model options not forwarded for openai-compatible providers - may be related to your configuration not working properly Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Sep 6, 2025):

What happens if you remove the /api/chat suffix from baseURL

@rekram1-node commented on GitHub (Sep 6, 2025): What happens if you remove the /api/chat suffix from baseURL
Author
Owner

@tnorlund commented on GitHub (Sep 6, 2025):

What happens if you remove the /api/chat suffix from baseURL

I get the same response.

@tnorlund commented on GitHub (Sep 6, 2025): > What happens if you remove the /api/chat suffix from baseURL I get the same response.
Author
Owner

@rekram1-node commented on GitHub (Sep 6, 2025):

what is the error? can you show me output of:

opencode run "hello" --model ollama/gpt-oss:20b --print-logs
@rekram1-node commented on GitHub (Sep 6, 2025): what is the error? can you show me output of: ``` opencode run "hello" --model ollama/gpt-oss:20b --print-logs ```
Author
Owner

@tnorlund commented on GitHub (Sep 6, 2025):

INFO  2025-09-06T22:13:13 +52ms service=default version=0.6.4 args=["run","hello","--model","ollama/gpt-oss:20b","--print-logs"] opencode
INFO  2025-09-06T22:13:13 +1ms service=project directory=/Users/tnorlund fromDirectory
INFO  2025-09-06T22:13:13 +8ms service=config path=/Users/tnorlund/.config/opencode/config.json loading
INFO  2025-09-06T22:13:13 +0ms service=config path=/Users/tnorlund/.config/opencode/opencode.json loading
INFO  2025-09-06T22:13:13 +2ms service=config path=/Users/tnorlund/.config/opencode/opencode.jsonc loading
INFO  2025-09-06T22:13:13 +3ms service=plugin path=opencode-copilot-auth@0.0.2 loading plugin
INFO  2025-09-06T22:13:13 +1ms service=plugin path=opencode-anthropic-auth@0.0.2 loading plugin
INFO  2025-09-06T22:13:13 +21ms service=bus type=* subscribing
INFO  2025-09-06T22:13:13 +0ms service=bus type=session.updated subscribing
INFO  2025-09-06T22:13:13 +0ms service=bus type=message.updated subscribing
INFO  2025-09-06T22:13:13 +0ms service=bus type=message.part.updated subscribing
INFO  2025-09-06T22:13:13 +0ms service=format init
INFO  2025-09-06T22:13:13 +0ms service=bus type=file.edited subscribing
INFO  2025-09-06T22:13:13 +1ms service=session id=ses_6dee8c941ffeijLTf2QbKU6pVx version=0.6.4 projectID=global directory=/Users/tnorlund title=New session - 2025-09-06T22:13:13.535Z time={"created":1757196793535,"updated":1757196793535} created
INFO  2025-09-06T22:13:13 +0ms service=lsp serverIds=typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd enabled LSP servers
INFO  2025-09-06T22:13:13 +0ms service=bus type=session.updated publishing
INFO  2025-09-06T22:13:13 +0ms service=bus type=message.part.updated subscribing
INFO  2025-09-06T22:13:13 +0ms service=bus type=session.error subscribing
INFO  2025-09-06T22:13:13 +1ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx chatting
INFO  2025-09-06T22:13:13 +2ms service=bus type=message.updated publishing
INFO  2025-09-06T22:13:13 +0ms service=bus type=message.part.updated publishing
INFO  2025-09-06T22:13:13 +1ms service=bus type=session.updated publishing
INFO  2025-09-06T22:13:13 +2ms service=models.dev file={} refreshing
INFO  2025-09-06T22:13:13 +1ms service=provider init
INFO  2025-09-06T22:13:13 +0ms service=provider providerID=openai found
INFO  2025-09-06T22:13:13 +0ms service=provider providerID=opencode found
INFO  2025-09-06T22:13:13 +0ms service=provider providerID=ollama found
INFO  2025-09-06T22:13:13 +0ms service=provider providerID=ollama modelID=gpt-oss:20b getModel
INFO  2025-09-06T22:13:13 +1ms service=provider status=started providerID=ollama getSDK
INFO  2025-09-06T22:13:13 +43ms service=provider status=completed duration=43 providerID=ollama getSDK
INFO  2025-09-06T22:13:13 +0ms service=provider providerID=ollama modelID=gpt-oss:20b found
INFO  2025-09-06T22:13:13 +2ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx sessionID=ses_6dee8c941ffeijLTf2QbKU6pVx locking
INFO  2025-09-06T22:13:13 +5ms service=bus type=message.updated publishing
INFO  2025-09-06T22:13:13 +4ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx type=start part
ERROR 2025-09-06T22:13:13 +254ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx error=Not Found model=gpt-oss:20b failed to generate title
ERROR 2025-09-06T22:13:14 +368ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx error={"error":{"name":"AI_APICallError","url":"https://ollama.com/api/chat/chat/completions","requestBodyValues":{"model":"gpt-oss:20b","max_tokens":32000,"messages":[{"role":"system","content":"You are opencode, an agent - please keep going until the user’s query is completely resolved, before ending your turn and yielding back to the user.\n\nYour thinking should be thorough and so it's fine if it's very long. However, avoid unnecessary repetition and verbosity. You should be concise, but thorough.\n\nYou MUST iterate and keep going until the problem is solved.\n\nYou have everything you need to resolve this problem. I want you to fully solve this autonomously before coming back to me.\n\nOnly terminate your turn when you are sure that the problem is solved and all items have been checked off. Go through the problem step by step, and make sure to verify that your changes are correct. NEVER end your turn without having truly and completely solved the problem, and when you say you are going to make a tool call, make sure you ACTUALLY make the tool call, instead of ending your turn.\n\nTHE PROBLEM CAN NOT BE SOLVED WITHOUT EXTENSIVE INTERNET RESEARCH.\n\nYou must use the webfetch tool to recursively gather all information from URL's provided to  you by the user, as well as any links you find in the content of those pages.\n\nYour knowledge on everything is out of date because your training date is in the past. \n\nYou CANNOT successfully complete this task without using Google to verify your\nunderstanding of third party packages and dependencies is up to date. You must use the webfetch tool to search google for how to properly use libraries, packages, frameworks, dependencies, etc. every single time you install or implement one. It is not enough to just search, you must also read the  content of the pages you find and recursively gather all relevant information by fetching additional links until you have all the information you need.\n\nAlways tell the user what you are going to do before making a tool call with a single concise sentence. This will help them understand what you are doing and why.\n\nIf the user request is \"resume\" or \"continue\" or \"try again\", check the previous conversation history to see what the next incomplete step in the todo list is. Continue from that step, and do not hand back control to the user until the entire todo list is complete and all items are checked off. Inform the user that you are continuing from the last incomplete step, and what that step is.\n\nTake your time and think through every step - remember to check your solution rigorously and watch out for boundary cases, especially with the changes you made. Use the sequential thinking tool if available. Your solution must be perfect. If not, continue working on it. At the end, you must test your code rigorously using the tools provided, and do it many times, to catch all edge cases. If it is not robust, iterate more and make it perfect. Failing to test your code sufficiently rigorously is the NUMBER ONE failure mode on these types of tasks; make sure you handle all edge cases, and run existing tests if they are provided.\n\nYou MUST plan extensively before each function call, and reflect extensively on the outcomes of the previous function calls. DO NOT do this entire process by making function calls only, as this can impair your ability to solve the problem and think insightfully.\n\nYou MUST keep working until the problem is completely solved, and all items in the todo list are checked off. Do not end your turn until you have completed all steps in the todo list and verified that everything is working correctly. When you say \"Next I will do X\" or \"Now I will do Y\" or \"I will do X\", you MUST actually do X or Y instead just saying that you will do it. \n\nYou are a highly capable and autonomous agent, and you can definitely solve this problem without needing to ask the user for further input.\n\n# Workflow\n1. Fetch any URL's provided by the user using the `webfetch` tool.\n2. Understand the problem deeply. Carefully read the issue and think critically about what is required. Use sequential thinking to break down the problem into manageable parts. Consider the following:\n   - What is the expected behavior?\n   - What are the edge cases?\n   - What are the potential pitfalls?\n   - How does this fit into the larger context of the codebase?\n   - What are the dependencies and interactions with other parts of the code?\n3. Investigate the codebase. Explore relevant files, search for key functions, and gather context.\n4. Research the problem on the internet by reading relevant articles, documentation, and forums.\n5. Develop a clear, step-by-step plan. Break down the fix into manageable, incremental steps. Display those steps in a simple todo list using emoji's to indicate the status of each item.\n6. Implement the fix incrementally. Make small, testable code changes.\n7. Debug as needed. Use debugging techniques to isolate and resolve issues.\n8. Test frequently. Run tests after each change to verify correctness.\n9. Iterate until the root cause is fixed and all tests pass.\n10. Reflect and validate comprehensively. After tests pass, think about the original intent, write additional tests to ensure correctness, and remember there are hidden tests that must also pass before the solution is truly complete.\n\nRefer to the detailed sections below for more information on each step.\n\n## 1. Fetch Provided URLs\n- If the user provides a URL, use the `webfetch` tool to retrieve the content of the provided URL.\n- After fetching, review the content returned by the webfetch tool.\n- If you find any additional URLs or links that are relevant, use the `webfetch` tool again to retrieve those links.\n- Recursively gather all relevant information by fetching additional links until you have all the information you need.\n\n## 2. Deeply Understand the Problem\nCarefully read the issue and think hard about a plan to solve it before coding.\n\n## 3. Codebase Investigation\n- Explore relevant files and directories.\n- Search for key functions, classes, or variables related to the issue.\n- Read and understand relevant code snippets.\n- Identify the root cause of the problem.\n- Validate and update your understanding continuously as you gather more context.\n\n## 4. Internet Research\n- Use the `webfetch` tool to search google by fetching the URL `https://www.google.com/search?q=your+search+query`.\n- After fetching, review the content returned by the fetch tool.\n- You MUST fetch the contents of the most relevant links to gather information. Do not rely on the summary that you find in the search results.\n- As you fetch each link, read the content thoroughly and fetch any additional links that you find withhin the content that are relevant to the problem.\n- Recursively gather all relevant information by fetching links until you have all the information you need.\n\n## 5. Develop a Detailed Plan \n- Outline a specific, simple, and verifiable sequence of steps to fix the problem.\n- Create a todo list in markdown format to track your progress.\n- Each time you complete a step, check it off using `[x]` syntax.\n- Each time you check off a step, display the updated todo list to the user.\n- Make sure that you ACTUALLY continue on to the next step after checkin off a step instead of ending your turn and asking the user what they want to do next.\n\n## 6. Making Code Changes\n- Before editing, always read the relevant file contents or section to ensure complete context.\n- Always read 2000 lines of code at a time to ensure you have enough context.\n- If a patch is not applied correctly, attempt to reapply it.\n- Make small, testable, incremental changes that logically follow from your investigation and plan.\n- Whenever you detect that a project requires an environment variable (such as an API key or secret), always check if a .env file exists in the project root. If it does not exist, automatically create a .env file with a placeholder for the required variable(s) and inform the user. Do this proactively, without waiting for the user to request it.\n\n## 7. Debugging\n- Make code changes only if you have high confidence they can solve the problem\n- When debugging, try to determine the root cause rather than addressing symptoms\n- Debug for as long as needed to identify the root cause and identify a fix\n- Use print statements, logs, or temporary code to inspect program state, including descriptive statements or error messages to understand what's happening\n- To test hypotheses, you can also add test statements or functions\n- Revisit your assumptions if unexpected behavior occurs.\n\n\n# Communication Guidelines\nAlways communicate clearly and concisely in a casual, friendly yet professional tone. \n<examples>\n\"Let me fetch the URL you provided to gather more information.\"\n\"Ok, I've got all of the information I need on the LIFX API and I know how to use it.\"\n\"Now, I will search the codebase for the function that handles the LIFX API requests.\"\n\"I need to update several files here - stand by\"\n\"OK! Now let's run the tests to make sure everything is working correctly.\"\n\"Whelp - I see we have some problems. Let's fix those up.\"\n</examples>\n\n- Respond with clear, direct answers. Use bullet points and code blocks for structure. - Avoid unnecessary explanations, repetition, and filler.  \n- Always write code directly to the correct files.\n- Do not display code to the user unless they specifically ask for it.\n- Only elaborate when clarification is essential for accuracy or user understanding.\n\n# Memory\nYou have a memory that stores information about the user and their preferences. This memory is used to provide a more personalized experience. You can access and update this memory as needed. The memory is stored in a file called `.github/instructions/memory.instruction.md`. If the file is empty, you'll need to create it. \n\nWhen creating a new memory file, you MUST include the following front matter at the top of the file:\n```yaml\n---\napplyTo: '**'\n---\n```\n\nIf the user asks you to remember something or add something to your memory, you can do so by updating the memory file.\n\n# Reading Files and Folders\n\n**Always check if you have already read a file, folder, or workspace structure before reading it again.**\n\n- If you have already read the content and it has not changed, do NOT re-read it.\n- Only re-read files or folders if:\n  - You suspect the content has changed since your last read.\n  - You have made edits to the file or folder.\n  - You encounter an error that suggests the context may be stale or incomplete.\n- Use your internal memory and previous context to avoid redundant reads.\n- This will save time, reduce unnecessary operations, and make your workflow more efficient.\n\n# Writing Prompts\nIf you are asked to write a prompt,  you should always generate the prompt in markdown format.\n\nIf you are not writing the prompt in a file, you should always wrap the prompt in triple backticks so that it is formatted correctly and can be easily copied from the chat.\n\nRemember that todo lists must always be written in markdown format and must always be wrapped in triple backticks.\n\n# Git \nIf the user tells you to stage and commit, you may do so. \n\nYou are NEVER allowed to stage and commit files automatically.\n"},{"role":"system","content":"Here is some useful information about the environment you are running in:\n<env>\n  Working directory: /Users/tnorlund\n  Is directory a git repo: no\n  Platform: darwin\n  Today's date: Sat Sep 06 2025\n</env>\n<project>\n  \n</project>"},{"role":"user","content":"hello"}],"tools":[{"type":"function","function":{"name":"bash","description":"Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.\n\nBefore executing the command, please follow these steps:\n\n1. Directory Verification:\n   - If the command will create new directories or files, first use the LS tool to verify the parent directory exists and is the correct location\n   - For example, before running \"mkdir foo/bar\", first use LS to check that \"foo\" exists and is the intended parent directory\n\n2. Command Execution:\n   - Always quote file paths that contain spaces with double quotes (e.g., cd \"path with spaces/file.txt\")\n   - Examples of proper quoting:\n     - cd \"/Users/name/My Documents\" (correct)\n     - cd /Users/name/My Documents (incorrect - will fail)\n     - python \"/path/with spaces/script.py\" (correct)\n     - python /path/with spaces/script.py (incorrect - will fail)\n   - After ensuring proper quoting, execute the command.\n   - Capture the output of the command.\n\nUsage notes:\n  - The command argument is required.\n  - You can specify an optional timeout in milliseconds (up to 600000ms / 10 minutes). If not specified, commands will timeout after 120000ms (2 minutes).\n  - It is very helpful if you write a clear, concise description of what this command does in 5-10 words.\n  - If the output exceeds 30000 characters, output will be truncated before being returned to you.\n  - VERY IMPORTANT: You MUST avoid using search commands like `find` and `grep`. Instead use Grep, Glob, or Task to search. You MUST avoid read tools like `cat`, `head`, `tail`, and `ls`, and use Read and LS to read files.\n  - If you _still_ need to run `grep`, STOP. ALWAYS USE ripgrep at `rg` (or /usr/bin/rg) first, which all opencode users have pre-installed.\n  - When issuing multiple commands, use the ';' or '&&' operator to separate them. DO NOT use newlines (newlines are ok in quoted strings).\n  - Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of `cd`. You may use `cd` if the User explicitly requests it.\n    <good-example>\n    pytest /foo/bar/tests\n    </good-example>\n    <bad-example>\n    cd /foo/bar && pytest tests\n    </bad-example>\n\n\n# Committing changes with git\n\nWhen the user asks you to create a new git commit, follow these steps carefully:\n\n1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel, each using the Bash tool:\n   - Run a git status command to see all untracked files.\n   - Run a git diff command to see both staged and unstaged changes that will be committed.\n   - Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.\n\n2. Analyze all staged changes (both previously staged and newly added) and draft a commit message. Wrap your analysis process in <commit_analysis> tags:\n\n<commit_analysis>\n- List the files that have been changed or added\n- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)\n- Brainstorm the purpose or motivation behind these changes\n- Assess the impact of these changes on the overall project\n- Check for any sensitive information that shouldn't be committed\n- Draft a concise (1-2 sentences) commit message that focuses on the \"why\" rather than the \"what\"\n- Ensure your language is clear, concise, and to the point\n- Ensure the message accurately reflects the changes and their purpose (i.e. \"add\" means a wholly new feature, \"update\" means an enhancement to an existing feature, \"fix\" means a bug fix, etc.)\n- Ensure the message is not generic (avoid words like \"Update\" or \"Fix\" without context)\n- Review the draft message to ensure it accurately reflects the changes and their purpose\n</commit_analysis>\n\n3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:\n   - Add relevant untracked files to the staging area.\n   - Run git status to make sure the commit succeeded.\n\n4. If the commit fails due to pre-commit hook changes, retry the commit ONCE to include these automated changes. If it fails again, it usually means a pre-commit hook is preventing the commit. If the commit succeeds but you notice that files were modified by the pre-commit hook, you MUST amend your commit to include them.\n\nImportant notes:\n- Use the git context at the start of this conversation to determine which files are relevant to your commit. Be careful not to stage and commit files (e.g. with `git add .`) that aren't relevant to your commit.\n- NEVER update the git config\n- DO NOT run additional commands to read or explore code, beyond what is available in the git context\n- DO NOT push to the remote repository\n- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.\n- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit\n- Ensure your commit message is meaningful and concise. It should explain the purpose of the changes, not just describe them.\n- Return an empty response - the user will see the git output directly\n\n# Creating pull requests\nUse the gh command via the Bash tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a Github URL use the gh command to get the information needed.\n\nIMPORTANT: When the user asks you to create a pull request, follow these steps carefully:\n\n1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from the main branch:\n   - Run a git status command to see all untracked files\n   - Run a git diff command to see both staged and unstaged changes that will be committed\n   - Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote\n   - Run a git log command and `git diff main...HEAD` to understand the full commit history for the current branch (from the time it diverged from the `main` branch)\n\n2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary. Wrap your analysis process in <pr_analysis> tags:\n\n<pr_analysis>\n- List the commits since diverging from the main branch\n- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)\n- Brainstorm the purpose or motivation behind these changes\n- Assess the impact of these changes on the overall project\n- Do not use tools to explore code, beyond what is available in the git context\n- Check for any sensitive information that shouldn't be committed\n- Draft a concise (1-2 bullet points) pull request summary that focuses on the \"why\" rather than the \"what\"\n- Ensure the summary accurately reflects all changes since diverging from the main branch\n- Ensure your language is clear, concise, and to the point\n- Ensure the summary accurately reflects the changes and their purpose (ie. \"add\" means a wholly new feature, \"update\" means an enhancement to an existing feature, \"fix\" means a bug fix, etc.)\n- Ensure the summary is not generic (avoid words like \"Update\" or \"Fix\" without context)\n- Review the draft summary to ensure it accurately reflects the changes and their purpose\n</pr_analysis>\n\n3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:\n   - Create new branch if needed\n   - Push to remote with -u flag if needed\n   - Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.\n<example>\ngh pr create --title \"the pr title\" --body \"$(cat <<'EOF'\n## Summary\n<1-3 bullet points>\nEOF\n)\"\n</example>\n\nImportant:\n- NEVER update the git config\n- Return the PR URL when you're done, so the user can see it\n\n# Other common operations\n- View comments on a Github PR: gh api repos/foo/bar/pulls/123/comments\n","parameters":{"type":"object","properties":{"command":{"type":"string","description":"The command to execute"},"timeout":{"type":"number","description":"Optional timeout in milliseconds"},"description":{"type":"string","description":"Clear, concise description of what this command does in 5-10 words. Examples:\nInput: ls\nOutput: Lists files in current directory\n\nInput: git status\nOutput: Shows working tree status\n\nInput: npm install\nOutput: Installs package dependencies\n\nInput: mkdir foo\nOutput: Creates directory 'foo'"}},"required":["command","description"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"edit","description":"Performs exact string replacements in files. \n\nUsage:\n- You must use your `Read` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file. \n- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the oldString or newString.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.\n- The edit will FAIL if `oldString` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use `replaceAll` to change every instance of `oldString`. \n- Use `replaceAll` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.\n","parameters":{"type":"object","properties":{"filePath":{"type":"string","description":"The absolute path to the file to modify"},"oldString":{"type":"string","description":"The text to replace"},"newString":{"type":"string","description":"The text to replace it with (must be different from oldString)"},"replaceAll":{"type":"boolean","description":"Replace all occurrences of oldString (default false)"}},"required":["filePath","oldString","newString"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"webfetch","description":"- Fetches content from a specified URL\n- Takes a URL and a prompt as input\n- Fetches the URL content, converts HTML to markdown\n- Returns the model's response about the content\n- Use this tool when you need to retrieve and analyze web content\n\nUsage notes:\n  - IMPORTANT: If an MCP-provided web fetch tool is available, prefer using that tool instead of this one, as it may have fewer restrictions. All MCP-provided tools start with \"mcp__\".\n  - The URL must be a fully-formed valid URL\n  - HTTP URLs will be automatically upgraded to HTTPS\n  - The prompt should describe what information you want to extract from the page\n  - This tool is read-only and does not modify any files\n  - Results may be summarized if the content is very large\n  - Includes a self-cleaning 15-minute cache for faster responses when repeatedly accessing the same URL\n","parameters":{"type":"object","properties":{"url":{"type":"string","description":"The URL to fetch content from"},"format":{"type":"string","enum":["text","markdown","html"],"description":"The format to return the content in (text, markdown, or html)"},"timeout":{"type":"number","description":"Optional timeout in seconds (max 120)"}},"required":["url","format"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"glob","description":"- Fast file pattern matching tool that works with any codebase size\n- Supports glob patterns like \"**/*.js\" or \"src/**/*.ts\"\n- Returns matching file paths sorted by modification time\n- Use this tool when you need to find files by name patterns\n- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead\n- You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.\n","parameters":{"type":"object","properties":{"pattern":{"type":"string","description":"The glob pattern to match files against"},"path":{"type":"string","description":"The directory to search in. If not specified, the current working directory will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter \"undefined\" or \"null\" - simply omit it for the default behavior. Must be a valid directory path if provided."}},"required":["pattern"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"grep","description":"- Fast content search tool that works with any codebase size\n- Searches file contents using regular expressions\n- Supports full regex syntax (eg. \"log.*Error\", \"function\\s+\\w+\", etc.)\n- Filter files by pattern with the include parameter (eg. \"*.js\", \"*.{ts,tsx}\")\n- Returns file paths with at least one match sorted by modification time\n- Use this tool when you need to find files containing specific patterns\n- If you need to identify/count the number of matches within files, use the Bash tool with `rg` (ripgrep) directly. Do NOT use `grep`.\n- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead\n","parameters":{"type":"object","properties":{"pattern":{"type":"string","description":"The regex pattern to search for in file contents"},"path":{"type":"string","description":"The directory to search in. Defaults to the current working directory."},"include":{"type":"string","description":"File pattern to include in the search (e.g. \"*.js\", \"*.{ts,tsx}\")"}},"required":["pattern"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"list","description":"Lists files and directories in a given path. The path parameter must be an absolute path, not a relative path. You can optionally provide an array of glob patterns to ignore with the ignore parameter. You should generally prefer the Glob and Grep tools, if you know which directories to search.\n","parameters":{"type":"object","properties":{"path":{"type":"string","description":"The absolute path to the directory to list (must be absolute, not relative)"},"ignore":{"type":"array","items":{"type":"string"},"description":"List of glob patterns to ignore"}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"read","description":"Reads a file from the local filesystem. You can access any file directly by using this tool.\nAssume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.\n\nUsage:\n- The filePath parameter must be an absolute path, not a relative path\n- By default, it reads up to 2000 lines starting from the beginning of the file\n- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters\n- Any lines longer than 2000 characters will be truncated\n- Results are returned using cat -n format, with line numbers starting at 1\n- This tool cannot read binary files, including images\n- You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful. \n- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.\n","parameters":{"type":"object","properties":{"filePath":{"type":"string","description":"The path to the file to read"},"offset":{"type":"number","description":"The line number to start reading from (0-based)"},"limit":{"type":"number","description":"The number of lines to read (defaults to 2000)"}},"required":["filePath"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"write","description":"Writes a file to the local filesystem.\n\nUsage:\n- This tool will overwrite the existing file if there is one at the provided path.\n- If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.\n- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.\n","parameters":{"type":"object","properties":{"filePath":{"type":"string","description":"The absolute path to the file to write (must be absolute, not relative)"},"content":{"type":"string","description":"The content to write to the file"}},"required":["filePath","content"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"todowrite","description":"Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.\nIt also helps the user understand the progress of the task and overall progress of their requests.\n\n## When to Use This Tool\nUse this tool proactively in these scenarios:\n\n1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions\n2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations\n3. User explicitly requests todo list - When the user directly asks you to use the todo list\n4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)\n5. After receiving new instructions - Immediately capture user requirements as todos. Feel free to edit the todo list based on new information.\n6. After completing a task - Mark it complete and add any new follow-up tasks\n7. When you start working on a new task, mark the todo as in_progress. Ideally you should only have one todo as in_progress at a time. Complete existing tasks before starting new ones.\n\n## When NOT to Use This Tool\n\nSkip using this tool when:\n1. There is only a single, straightforward task\n2. The task is trivial and tracking it provides no organizational benefit\n3. The task can be completed in less than 3 trivial steps\n4. The task is purely conversational or informational\n\nNOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.\n\n## Examples of When to Use the Todo List\n\n<example>\nUser: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!\nAssistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.\n*Creates todo list with the following items:*\n1. Create dark mode toggle component in Settings page\n2. Add dark mode state management (context/store)\n3. Implement CSS-in-JS styles for dark theme\n4. Update existing components to support theme switching\n5. Run tests and build process, addressing any failures or errors that occur\n*Begins working on the first task*\n\n<reasoning>\nThe assistant used the todo list because:\n1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes\n2. The user explicitly requested tests and build be run afterward\n3. The assistant inferred that tests and build need to pass by adding \"Ensure tests and build succeed\" as the final task\n</reasoning>\n</example>\n\n<example>\nUser: Help me rename the function getCwd to getCurrentWorkingDirectory across my project\nAssistant: Let me first search through your codebase to find all occurrences of 'getCwd'.\n*Uses grep or search tools to locate all instances of getCwd in the codebase*\nAssistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.\n*Creates todo list with specific items for each file that needs updating*\n\n<reasoning>\nThe assistant used the todo list because:\n1. First, the assistant searched to understand the scope of the task\n2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps\n3. The todo list helps ensure every instance is tracked and updated systematically\n4. This approach prevents missing any occurrences and maintains code consistency\n</reasoning>\n</example>\n\n\n<example>\nUser: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.\nAssistant: I'll help implement these features. First, let's add all the features to the todo list.\n*Creates a todo list breaking down each feature into specific tasks based on the project architecture*\nAssistant: Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.\n\n<reasoning>\nThe assistant used the todo list because:\n1. The user provided multiple complex features to implement in a comma separated list\n2. The todo list helps organize these large features into manageable tasks\n3. This approach allows for tracking progress across the entire implementation\n</reasoning>\n</example>\n\n<example>\nUser: Can you help optimize my React application? It's rendering slowly and has performance issues.</user>\nAssistant: I'll help optimize your React application. First, let me examine your codebase to identify potential performance bottlenecks.\n*Reviews component structure, render patterns, state management, and data fetching*\nAssistant: After analyzing your codebase, I've identified several performance issues. Let me create a todo list to track our optimization efforts.\n*Creates todo list with items like: 1) Implement memoization for expensive calculations in ProductList, 2) Add virtualization for long lists in Dashboard, 3) Optimize image loading in Gallery component, 4) Fix state update loops in ShoppingCart, 5) Review bundle size and implement code splitting*\nLet's start by implementing memoization for the expensive calculations in your ProductList component.</assistant>\n\n<reasoning>\nThe assistant used the todo list because:\n1. First, the assistant examined the codebase to identify specific performance issues\n2. Based on this analysis, it identified multiple optimization opportunities\n3. Performance optimization is a non-trivial task requiring multiple steps\n4. The todo list helps methodically track improvements across different components\n5. This systematic approach ensures all performance bottlenecks are addressed\n</reasoning>\n</example>\n\n## Examples of When NOT to Use the Todo List\n\n<example>\nUser: How do I print 'Hello World' in Python?\nAssistant: In Python, you can print \"Hello World\" with this simple code:\n\npython\nprint(\"Hello World\")\n\nThis will output the text \"Hello World\" to the console when executed.</assistant>\n\n<reasoning>\nThe assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.\n</reasoning>\n</example>\n\n<example>\nUser: What does the git status command do?\nAssistant: The git status command shows the current state of your working directory and staging area. It displays which changes have been staged, which haven't, and which files aren't being tracked by Git. This is a fundamental command for understanding the current state of your repository before making commits.\n\n<reasoning>\nThe assistant did not use the todo list because this is an informational request with no actual coding task to complete. The user is simply asking for an explanation, not for the assistant to perform multiple steps or tasks.\n</reasoning>\n</example>\n\n<example>\nUser: Can you add a comment to the calculateTotal function to explain what it does?\nAssistant: Sure, let me add a comment to the calculateTotal function to explain what it does.\n* Uses the Edit tool to add a comment to the calculateTotal function *\n\n<reasoning>\nThe assistant did not use the todo list because this is a single, straightforward task confined to one location in the code. Adding a comment doesn't require tracking multiple steps or systematic organization.\n</reasoning>\n</example>\n\n<example>\nUser: Run npm install for me and tell me what happens.\nAssistant: I'll run the npm install command for you.\n\n*Executes: npm install*\n\nThe command completed successfully. Here's the output:\n[Output of npm install command]\n\nAll dependencies have been installed according to your package.json file.\n\n<reasoning>\nThe assistant did not use the todo list because this is a single command execution with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward task.\n</reasoning>\n</example>\n\n## Task States and Management\n\n1. **Task States**: Use these states to track progress:\n   - pending: Task not yet started\n   - in_progress: Currently working on (limit to ONE task at a time)\n   - completed: Task finished successfully\n   - cancelled: Task no longer needed\n\n2. **Task Management**:\n   - Update task status in real-time as you work\n   - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)\n   - Only have ONE task in_progress at any time\n   - Complete current tasks before starting new ones\n   - Cancel tasks that become irrelevant\n\n3. **Task Breakdown**:\n   - Create specific, actionable items\n   - Break complex tasks into smaller, manageable steps\n   - Use clear, descriptive task names\n\nWhen in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.\n\n","parameters":{"type":"object","properties":{"todos":{"type":"array","items":{"type":"object","properties":{"content":{"type":"string","description":"Brief description of the task"},"status":{"type":"string","description":"Current status of the task: pending, in_progress, completed, cancelled"},"priority":{"type":"string","description":"Priority level of the task: high, medium, low"},"id":{"type":"string","description":"Unique identifier for the todo item"}},"required":["content","status","priority","id"],"additionalProperties":false},"description":"The updated todo list"}},"required":["todos"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"todoread","description":"Use this tool to read your todo list","parameters":{"type":"object","properties":{},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"task","description":"Launch a new agent to handle complex, multi-step tasks autonomously.\n\nAvailable agent types and the tools they have access to:\n- general: General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you.\n\nWhen using the Task tool, you must specify a subagent_type parameter to select which agent type to use.\n\nWhen to use the Agent tool:\n- When you are instructed to execute custom slash commands. Use the Agent tool with the slash command invocation as the entire prompt. The slash command can take arguments. For example: Task(description=\"Check the file\", prompt=\"/check-file path/to/file.py\")\n\nWhen NOT to use the Agent tool:\n- If you want to read a specific file path, use the Read or Glob tool instead of the Agent tool, to find the match more quickly\n- If you are searching for a specific class definition like \"class Foo\", use the Glob tool instead, to find the match more quickly\n- If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Agent tool, to find the match more quickly\n- Other tasks that are not related to the agent descriptions above\n\n\nUsage notes:\n1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses\n2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.\n3. Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.\n4. The agent's outputs should generally be trusted\n5. Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent\n6. If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.\n\nExample usage (NOTE: The agents below are fictional examples for illustration only - use the actual agents listed above):\n\n<example_agent_descriptions>\n\"code-reviewer\": use this agent after you are done writing a signficant piece of code\n\"greeting-responder\": use this agent when to respond to user greetings with a friendly joke\n</example_agent_description>\n\n<example>\nuser: \"Please write a function that checks if a number is prime\"\nassistant: Sure let me write a function that checks if a number is prime\nassistant: First let me use the Write tool to write a function that checks if a number is prime\nassistant: I'm going to use the Write tool to write the following code:\n<code>\nfunction isPrime(n) {\n  if (n <= 1) return false\n  for (let i = 2; i * i <= n; i++) {\n    if (n % i === 0) return false\n  }\n  return true\n}\n</code>\n<commentary>\nSince a signficant piece of code was written and the task was completed, now use the code-reviewer agent to review the code\n</commentary>\nassistant: Now let me use the code-reviewer agent to review the code\nassistant: Uses the Task tool to launch the code-reviewer agent\n</example>\n\n<example>\nuser: \"Hello\"\n<commentary>\nSince the user is greeting, use the greeting-responder agent to respond with a friendly joke\n</commentary>\nassistant: \"I'm going to use the Task tool to launch the with the greeting-responder agent\"\n</example>\n","parameters":{"type":"object","properties":{"description":{"type":"string","description":"A short (3-5 words) description of the task"},"prompt":{"type":"string","description":"The task for the agent to perform"},"subagent_type":{"type":"string","description":"The type of specialized agent to use for this task"}},"required":["description","prompt","subagent_type"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}],"tool_choice":"auto","stream":true},"statusCode":404,"responseHeaders":{"alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000","content-type":"text/html; charset=utf-8","date":"Sat, 06 Sep 2025 22:13:14 GMT","transfer-encoding":"chunked","via":"1.1 google","x-build-commit":"5669830f84f981009e2ea28ba3c01fd564ab374c","x-build-time":"1757031932","x-frame-options":"DENY","x-request-id":"713d9ead-e5be-4535-b0e1-6931ecfda9d6","set-cookie":"aid=7ee21399-b25e-4c26-a2d2-20de970683ea; Path=/; Max-Age=31536000; HttpOnly; Secure; SameSite=Lax"},"responseBody":"\n\n\n\n\n\n\n<!doctype html>\n<html class=\"h-full overflow-y-scroll\">\n  <head>\n    <title>Ollama</title>\n\n    <meta charset=\"utf-8\" />\n    <meta name=\"description\" content=\"Get up and running with large language models.\"/>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <meta property=\"og:title\" content=\"Ollama\" />\n    <meta property=\"og:description\" content=\"Get up and running with large language models.\" />\n    <meta property=\"og:url\" content=\"https://ollama.com\" />\n    <meta property=\"og:image\" content=\"https://ollama.com/public/og.png\" />\n    <meta property=\"og:image:type\" content=\"image/png\" />\n    <meta property=\"og:image:width\" content=\"1200\" />\n    <meta property=\"og:image:height\" content=\"628\" />\n    <meta property=\"og:type\" content=\"website\" />\n\n    <meta name=\"robots\" content=\"index, follow\" />\n\n    <meta property=\"twitter:card\" content=\"summary\" />\n    <meta property=\"twitter:title\" content=\"Ollama\" />\n    <meta property=\"twitter:description\" content=\"Get up and running with large language models.\" />\n    <meta property=\"twitter:site\" content=\"ollama\" />\n\n    <meta property=\"twitter:image:src\" content=\"https://ollama.com/public/og-twitter.png\" />\n    <meta property=\"twitter:image:width\" content=\"1200\" />\n    <meta property=\"twitter:image:height\" content=\"628\" />\n\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1\">\n\n    <link rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/public/icon-16x16.png\" />\n    <link rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/public/icon-32x32.png\" />\n    <link rel=\"icon\" type=\"image/png\" sizes=\"48x48\" href=\"/public/icon-48x48.png\" />\n    <link rel=\"icon\" type=\"image/png\" sizes=\"64x64\" href=\"/public/icon-64x64.png\" />\n    <link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"/public/apple-touch-icon.png\" />\n    <link rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/public/android-chrome-icon-192x192.png\" />\n    <link rel=\"icon\" type=\"image/png\" sizes=\"512x512\" href=\"/public/android-chrome-icon-512x512.png\" />\n\n    \n    \n\n    <link href=\"/public/tailwind.css?v=62f47bdec326e80b8b5a49551dfb2f03\" rel=\"stylesheet\" />\n    <script type=\"application/ld+json\">\n      {\n        \"@context\": \"https://schema.org\",\n        \"@type\": \"WebSite\",\n        \"name\": \"Ollama\",\n        \"url\": \"https://ollama.com\"\n      }\n    </script>\n\n    <script type=\"text/javascript\">\n      function copyToClipboard(element) {\n        let commandElement = null;\n        const preElement = element.closest('pre');\n        const languageNoneElement = element.closest('.language-none');\n\n        if (preElement) {\n          commandElement = preElement.querySelector('code');\n        } else if (languageNoneElement) {\n          commandElement = languageNoneElement.querySelector('.command');\n        } else {\n          const parent = element.parentElement;\n          if (parent) {\n            commandElement = parent.querySelector('.command');\n          }\n        }\n\n        if (!commandElement) {\n          console.error('No code or command element found');\n          return;\n        }\n\n        const code = commandElement.textContent ? commandElement.textContent.trim() : commandElement.value;\n\n        navigator.clipboard\n          .writeText(code)\n          .then(() => {\n            const copyIcon = element.querySelector('.copy-icon')\n            const checkIcon = element.querySelector('.check-icon')\n\n            copyIcon.classList.add('hidden')\n            checkIcon.classList.remove('hidden')\n\n            setTimeout(() => {\n              copyIcon.classList.remove('hidden')\n              checkIcon.classList.add('hidden')\n            }, 2000)\n          })\n      }\n    </script>\n    \n    <script>\n      \n      function getIcon(url) {\n        url = url.toLowerCase();\n        if (url.includes('x.com') || url.includes('twitter.com')) return 'x';\n        if (url.includes('github.com')) return 'github';\n        if (url.includes('linkedin.com')) return 'linkedin';\n        if (url.includes('youtube.com')) return 'youtube';\n        if (url.includes('hf.co') || url.includes('huggingface.co') || url.includes('huggingface.com')) return 'hugging-face';\n        return 'default';\n      }\n\n      function setInputIcon(input) {\n        const icon = getIcon(input.value);\n        const img = input.previousElementSibling.querySelector('img');\n        img.src = `/public/social/${icon}.svg`;\n        img.alt = `${icon} icon`;\n      }\n\n      function setDisplayIcon(imgElement, url) {\n        const icon = getIcon(url);\n        imgElement.src = `/public/social/${icon}.svg`;\n        imgElement.alt = `${icon} icon`;\n      }\n    </script>\n    \n    <script src=\"/public/vendor/htmx/bundle.js\"></script>\n    \n  </head>\n\n  <body\n    class=\"\n      antialiased\n      min-h-screen\n      w-full\n      m-0\n      flex\n      flex-col\n    \"\n    hx-on:keydown=\"\n      if (event.target.tagName === 'INPUT' || event.target.tagName === 'TEXTAREA') {\n        // Ignore key events in input fields.\n        return;\n      }\n      if ((event.metaKey && event.key === 'k') || event.key === '/') {\n        event.preventDefault();\n        const sp = htmx.find('#search') || htmx.find('#navbar-input');\n        sp.focus();\n      }\n    \"\n  >\n      \n<header class=\"sticky top-0 z-40 bg-white underline-offset-4 lg:static\">\n  <nav class=\"flex w-full items-center justify-between px-6 py-3.5\">\n    <a href=\"/\" class=\"z-50\">\n      <img src=\"/public/ollama.png\" class=\"w-8\" alt=\"Ollama\" />\n    </a>\n    \n    \n    <div class=\"hidden lg:flex xl:flex-1 items-center space-x-6 ml-6 mr-6 xl:mr-0 text-lg\">\n      <a class=\"hover:underline focus:underline focus:outline-none focus:ring-0\" href=\"/models\">Models</a>\n      <a class=\"hover:underline focus:underline focus:outline-none focus:ring-0\" href=\"https://github.com/ollama/ollama\">GitHub</a>\n      <a class=\"hover:underline focus:underline focus:outline-none focus:ring-0\" href=\"https://discord.gg/ollama\">Discord</a>\n      <a class=\"hover:underline focus:underline focus:outline-none focus:ring-0\" href=\"/turbo\">Turbo</a>\n    </div>\n\n    \n    <div class=\"flex-grow justify-center items-center hidden lg:flex xl:-ml-8\">\n      <div class=\"relative w-full xl:max-w-[28rem]\">\n        \n<form action=\"/search\" autocomplete=\"off\">\n  <div \n    class=\"relative flex w-full appearance-none bg-black/5 border border-neutral-100 items-center rounded-full\"\n    hx-on:focusout=\"\n      if (!this.contains(event.relatedTarget)) {\n        const searchPreview = document.querySelector('#searchpreview');\n        if (searchPreview) {\n          htmx.addClass('#searchpreview', 'hidden');\n        }\n      }\n    \"\n  >\n  <span id=\"searchIcon\" class=\"pl-2 text-2xl text-neutral-500\">\n    <svg class=\"mt-0.25 ml-1.5 h-5 w-5 fill-current\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\">\n      <path d=\"m8.5 3c3.0375661 0 5.5 2.46243388 5.5 5.5 0 1.24832096-.4158777 2.3995085-1.1166416 3.3225711l4.1469717 4.1470988c.2928932.2928932.2928932.767767 0 1.0606602-.2662666.2662665-.6829303.2904726-.9765418.0726181l-.0841184-.0726181-4.1470988-4.1469717c-.9230626.7007639-2.07425014 1.1166416-3.3225711 1.1166416-3.03756612 0-5.5-2.4624339-5.5-5.5 0-3.03756612 2.46243388-5.5 5.5-5.5zm0 1.5c-2.209139 0-4 1.790861-4 4s1.790861 4 4 4 4-1.790861 4-4-1.790861-4-4-4z\" />\n    </svg>\n  </span>\n  <input\n    id=\"search\"\n    hx-get=\"/search\"\n    hx-trigger=\"keyup changed delay:100ms, focus\"\n    hx-target=\"#searchpreview\"\n    hx-swap=\"innerHTML\"\n    name=\"q\"\n    class=\"resize-none rounded-full border-0 py-2.5 bg-transparent text-sm w-full placeholder:text-neutral-500 focus:outline-none focus:ring-0\"\n    placeholder=\"Search models\"\n    autocomplete=\"off\"\n    hx-on:keydown=\"\n      if (event.key === 'Enter') {\n        event.preventDefault();\n        window.location.href = '/search?q=' + encodeURIComponent(this.value);\n        return;\n      }\n      if (event.key === 'Escape') {\n        event.preventDefault();\n        this.value = '';\n        this.blur();\n        htmx.addClass('#searchpreview', 'hidden');\n        return;\n      }\n      if (event.key === 'Tab') { \n        htmx.addClass('#searchpreview', 'hidden');\n        return;\n      }\n      if (event.key === 'ArrowDown') {\n        let first = document.querySelector('#search-preview-list a:first-of-type');\n        first?.focus();\n        event.preventDefault();\n      }\n      if (event.key === 'ArrowUp') {\n        let last = document.querySelector('#view-all-link');\n        last?.focus();\n        event.preventDefault();\n      }\n      htmx.removeClass('#searchpreview', 'hidden');\n    \"\n    hx-on:focus=\"\n      htmx.removeClass('#searchpreview', 'hidden')\n    \"\n  />\n</form>\n<div id=\"searchpreview\" class=\"hidden absolute left-0 right-0 top-12 z-50\" style=\"width: calc(100% + 2px); margin-left: -1px;\"></div>\n</div>\n\n      </div>\n    </div>\n\n    \n    <div class=\"hidden lg:flex xl:flex-1 items-center space-x-2 justify-end ml-6 xl:ml-0\">\n      \n        <a class=\"flex cursor-pointer items-center rounded-full bg-black/5 hover:bg-black/10 text-lg px-4 py-1.5 text-black whitespace-nowrap\" href=\"/signin\">Sign in</a>\n        <a class=\"flex cursor-pointer items-center rounded-full bg-neutral-800 text-lg px-4 py-1.5 text-white hover:bg-black whitespace-nowrap focus:bg-black\" href=\"/download\">Download</a>\n      \n    </div>\n    \n    \n    <div class=\"lg:hidden flex items-center\">\n      <input type=\"checkbox\" id=\"menu\" class=\"peer hidden\" />\n      <label for=\"menu\" class=\"z-50 cursor-pointer peer-checked:hidden block\">\n        <svg\n          class=\"h-8 w-8\"\n          fill=\"none\"\n          viewBox=\"0 0 24 24\"\n          stroke-width=\"1.5\"\n          stroke=\"currentColor\"\n          aria-hidden=\"true\"\n        >\n          <path\n            stroke-linecap=\"round\"\n            stroke-linejoin=\"round\"\n            d=\"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5\"\n          />\n        </svg>\n      </label>\n      <label for=\"menu\" class=\"z-50 cursor-pointer hidden peer-checked:block fixed top-4 right-6\">\n        <svg\n          class=\"h-8 w-8\"\n          fill=\"none\"\n          viewBox=\"0 0 24 24\"\n          stroke-width=\"1.5\"\n          stroke=\"currentColor\"\n          aria-hidden=\"true\"\n        >\n          <path\n            stroke-linecap=\"round\"\n            stroke-linejoin=\"round\"\n            d=\"M6 18L18 6M6 6l12 12\"\n          />\n        </svg>\n      </label>\n      \n      <div class=\"fixed inset-0 bg-white z-40 hidden peer-checked:block overflow-y-auto\">\n        <div class=\"flex flex-col space-y-5 pt-[5.5rem] text-3xl\">\n          \n          <a class=\"px-6\" href=\"/models\">Models</a>\n\n          \n          <a class=\"px-6\" href=\"/download\">Download</a>\n          <a class=\"px-6\" href=\"https://github.com/ollama/ollama\">GitHub</a>\n          <a class=\"px-6\" href=\"https://discord.gg/ollama\">Discord</a>\n\n          \n          <a href=\"/signin\" class=\"block px-6\">Sign in</a>\n          \n\n          \n        </div>\n      </div>\n    </div>\n  </nav>\n</header>\n\n\n    <main class=\"mx-auto flex max-w-4xl flex-1 flex-col-reverse items-center justify-center p-32 md:flex-row md:items-start md:justify-between\">\n  <div class=\"space-y-2 text-center md:pt-6 md:text-left\">\n    <h2 class=\"text-3xl font-normal tracking-tight md:text-4xl\">\n      404.\n      <span class=\"text-neutral-400\"> That's an error. </span>\n    </h2>\n    <p class=\"text-center text-lg md:text-left md:text-xl\">\n      The page was not found.\n    </p>\n  </div>\n  <div class=\"pb-4 md:pb-0\">\n    <img src=\"/public/400s.svg\" class=\"w-40 md:w-48\" alt=\"400s ollama\" />\n  </div>\n</main>\n\n    \n<footer class=\"mt-auto\">\n  <div class=\"bg-white underline-offset-4 hidden md:block\">\n    <div class=\"flex items-center justify-between px-6 py-3.5\">\n      <div class=\"text-xs text-neutral-500\">© 2025 Ollama</div>\n      <div class=\"flex space-x-6 text-xs text-neutral-500\">\n      <a href=\"/download\" class=\"hover:underline\">Download</a>\n        <a href=\"/blog\" class=\"hover:underline\">Blog</a>\n        <a href=\"https://github.com/ollama/ollama/tree/main/docs\" class=\"hover:underline\">Docs</a>\n        <a href=\"https://github.com/ollama/ollama\" class=\"hover:underline\">GitHub</a>\n        <a href=\"https://discord.com/invite/ollama\" class=\"hover:underline\">Discord</a>\n        <a href=\"https://twitter.com/ollama\" class=\"hover:underline\">X (Twitter)</a>\n        <a href=\"mailto:hello@ollama.com\" class=\"hover:underline\">Contact Us</a>\n      </div>\n    </div>\n  </div>\n  <div class=\"bg-white py-4 md:hidden\">\n    <div class=\"flex flex-col items-center justify-center\">\n      <ul class=\"flex flex-wrap items-center justify-center text-sm text-neutral-500\">\n        <li class=\"mx-2 my-1\">\n          <a href=\"/blog\" class=\"hover:underline\">Blog</a>\n        </li>\n        <li class=\"mx-2 my-1\">\n          <a href=\"/download\" class=\"hover:underline\">Download</a>\n        </li>\n        <li class=\"mx-2 my-1\">\n          <a href=\"https://github.com/ollama/ollama/tree/main/docs\" class=\"hover:underline\">Docs</a>\n        </li>\n      </ul>\n      <ul class=\"flex flex-wrap items-center justify-center text-sm text-neutral-500\">\n        <li class=\"mx-2 my-1\">\n          <a href=\"https://github.com/ollama/ollama\" class=\"hover:underline\">GitHub</a>\n        </li>\n        <li class=\"mx-2 my-1\">\n          <a href=\"https://discord.com/invite/ollama\" class=\"hover:underline\">Discord</a>\n        </li>\n        <li class=\"mx-2 my-1\">\n          <a href=\"https://twitter.com/ollama\" class=\"hover:underline\">X (Twitter)</a>\n        </li>\n        <li class=\"mx-2 my-1\">\n          <a href=\"https://lu.ma/ollama\" class=\"hover:underline\">Meetups</a>\n        </li>\n      </ul>\n      <div class=\"mt-2 flex items-center justify-center text-sm text-neutral-500\">\n        © 2025 Ollama Inc.\n      </div>\n    </div>\n  </div>\n</footer>\n\n\n    \n    <span class=\"hidden\" id=\"end_of_template\"></span>\n  </body>\n</html>\n","isRetryable":false}} streamText error
INFO  2025-09-06T22:13:14 +3ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx type=error part
ERROR 2025-09-06T22:13:14 +0ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx error=Not Found
INFO  2025-09-06T22:13:14 +0ms service=bus type=session.error publishing
Error: AI_APICallError: Not Found
INFO  2025-09-06T22:13:14 +3ms service=bus type=message.updated publishing
INFO  2025-09-06T22:13:14 +0ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx sessionID=ses_6dee8c941ffeijLTf2QbKU6pVx unlocking

INFO  2025-09-06T22:13:14 +2ms service=bus type=session.idle publishing
tnorlund@Tylers-MacBook-Pro ~ %```
@tnorlund commented on GitHub (Sep 6, 2025): ```tnorlund@Tylers-MacBook-Pro ~ % opencode run "hello" --model ollama/gpt-oss:20b --print-logs INFO 2025-09-06T22:13:13 +52ms service=default version=0.6.4 args=["run","hello","--model","ollama/gpt-oss:20b","--print-logs"] opencode INFO 2025-09-06T22:13:13 +1ms service=project directory=/Users/tnorlund fromDirectory INFO 2025-09-06T22:13:13 +8ms service=config path=/Users/tnorlund/.config/opencode/config.json loading INFO 2025-09-06T22:13:13 +0ms service=config path=/Users/tnorlund/.config/opencode/opencode.json loading INFO 2025-09-06T22:13:13 +2ms service=config path=/Users/tnorlund/.config/opencode/opencode.jsonc loading INFO 2025-09-06T22:13:13 +3ms service=plugin path=opencode-copilot-auth@0.0.2 loading plugin INFO 2025-09-06T22:13:13 +1ms service=plugin path=opencode-anthropic-auth@0.0.2 loading plugin INFO 2025-09-06T22:13:13 +21ms service=bus type=* subscribing INFO 2025-09-06T22:13:13 +0ms service=bus type=session.updated subscribing INFO 2025-09-06T22:13:13 +0ms service=bus type=message.updated subscribing INFO 2025-09-06T22:13:13 +0ms service=bus type=message.part.updated subscribing INFO 2025-09-06T22:13:13 +0ms service=format init INFO 2025-09-06T22:13:13 +0ms service=bus type=file.edited subscribing INFO 2025-09-06T22:13:13 +1ms service=session id=ses_6dee8c941ffeijLTf2QbKU6pVx version=0.6.4 projectID=global directory=/Users/tnorlund title=New session - 2025-09-06T22:13:13.535Z time={"created":1757196793535,"updated":1757196793535} created INFO 2025-09-06T22:13:13 +0ms service=lsp serverIds=typescript, vue, eslint, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, rust, clangd enabled LSP servers INFO 2025-09-06T22:13:13 +0ms service=bus type=session.updated publishing INFO 2025-09-06T22:13:13 +0ms service=bus type=message.part.updated subscribing INFO 2025-09-06T22:13:13 +0ms service=bus type=session.error subscribing INFO 2025-09-06T22:13:13 +1ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx chatting INFO 2025-09-06T22:13:13 +2ms service=bus type=message.updated publishing INFO 2025-09-06T22:13:13 +0ms service=bus type=message.part.updated publishing INFO 2025-09-06T22:13:13 +1ms service=bus type=session.updated publishing INFO 2025-09-06T22:13:13 +2ms service=models.dev file={} refreshing INFO 2025-09-06T22:13:13 +1ms service=provider init INFO 2025-09-06T22:13:13 +0ms service=provider providerID=openai found INFO 2025-09-06T22:13:13 +0ms service=provider providerID=opencode found INFO 2025-09-06T22:13:13 +0ms service=provider providerID=ollama found INFO 2025-09-06T22:13:13 +0ms service=provider providerID=ollama modelID=gpt-oss:20b getModel INFO 2025-09-06T22:13:13 +1ms service=provider status=started providerID=ollama getSDK INFO 2025-09-06T22:13:13 +43ms service=provider status=completed duration=43 providerID=ollama getSDK INFO 2025-09-06T22:13:13 +0ms service=provider providerID=ollama modelID=gpt-oss:20b found INFO 2025-09-06T22:13:13 +2ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx sessionID=ses_6dee8c941ffeijLTf2QbKU6pVx locking INFO 2025-09-06T22:13:13 +5ms service=bus type=message.updated publishing INFO 2025-09-06T22:13:13 +4ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx type=start part ERROR 2025-09-06T22:13:13 +254ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx error=Not Found model=gpt-oss:20b failed to generate title ERROR 2025-09-06T22:13:14 +368ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx error={"error":{"name":"AI_APICallError","url":"https://ollama.com/api/chat/chat/completions","requestBodyValues":{"model":"gpt-oss:20b","max_tokens":32000,"messages":[{"role":"system","content":"You are opencode, an agent - please keep going until the user’s query is completely resolved, before ending your turn and yielding back to the user.\n\nYour thinking should be thorough and so it's fine if it's very long. However, avoid unnecessary repetition and verbosity. You should be concise, but thorough.\n\nYou MUST iterate and keep going until the problem is solved.\n\nYou have everything you need to resolve this problem. I want you to fully solve this autonomously before coming back to me.\n\nOnly terminate your turn when you are sure that the problem is solved and all items have been checked off. Go through the problem step by step, and make sure to verify that your changes are correct. NEVER end your turn without having truly and completely solved the problem, and when you say you are going to make a tool call, make sure you ACTUALLY make the tool call, instead of ending your turn.\n\nTHE PROBLEM CAN NOT BE SOLVED WITHOUT EXTENSIVE INTERNET RESEARCH.\n\nYou must use the webfetch tool to recursively gather all information from URL's provided to you by the user, as well as any links you find in the content of those pages.\n\nYour knowledge on everything is out of date because your training date is in the past. \n\nYou CANNOT successfully complete this task without using Google to verify your\nunderstanding of third party packages and dependencies is up to date. You must use the webfetch tool to search google for how to properly use libraries, packages, frameworks, dependencies, etc. every single time you install or implement one. It is not enough to just search, you must also read the content of the pages you find and recursively gather all relevant information by fetching additional links until you have all the information you need.\n\nAlways tell the user what you are going to do before making a tool call with a single concise sentence. This will help them understand what you are doing and why.\n\nIf the user request is \"resume\" or \"continue\" or \"try again\", check the previous conversation history to see what the next incomplete step in the todo list is. Continue from that step, and do not hand back control to the user until the entire todo list is complete and all items are checked off. Inform the user that you are continuing from the last incomplete step, and what that step is.\n\nTake your time and think through every step - remember to check your solution rigorously and watch out for boundary cases, especially with the changes you made. Use the sequential thinking tool if available. Your solution must be perfect. If not, continue working on it. At the end, you must test your code rigorously using the tools provided, and do it many times, to catch all edge cases. If it is not robust, iterate more and make it perfect. Failing to test your code sufficiently rigorously is the NUMBER ONE failure mode on these types of tasks; make sure you handle all edge cases, and run existing tests if they are provided.\n\nYou MUST plan extensively before each function call, and reflect extensively on the outcomes of the previous function calls. DO NOT do this entire process by making function calls only, as this can impair your ability to solve the problem and think insightfully.\n\nYou MUST keep working until the problem is completely solved, and all items in the todo list are checked off. Do not end your turn until you have completed all steps in the todo list and verified that everything is working correctly. When you say \"Next I will do X\" or \"Now I will do Y\" or \"I will do X\", you MUST actually do X or Y instead just saying that you will do it. \n\nYou are a highly capable and autonomous agent, and you can definitely solve this problem without needing to ask the user for further input.\n\n# Workflow\n1. Fetch any URL's provided by the user using the `webfetch` tool.\n2. Understand the problem deeply. Carefully read the issue and think critically about what is required. Use sequential thinking to break down the problem into manageable parts. Consider the following:\n - What is the expected behavior?\n - What are the edge cases?\n - What are the potential pitfalls?\n - How does this fit into the larger context of the codebase?\n - What are the dependencies and interactions with other parts of the code?\n3. Investigate the codebase. Explore relevant files, search for key functions, and gather context.\n4. Research the problem on the internet by reading relevant articles, documentation, and forums.\n5. Develop a clear, step-by-step plan. Break down the fix into manageable, incremental steps. Display those steps in a simple todo list using emoji's to indicate the status of each item.\n6. Implement the fix incrementally. Make small, testable code changes.\n7. Debug as needed. Use debugging techniques to isolate and resolve issues.\n8. Test frequently. Run tests after each change to verify correctness.\n9. Iterate until the root cause is fixed and all tests pass.\n10. Reflect and validate comprehensively. After tests pass, think about the original intent, write additional tests to ensure correctness, and remember there are hidden tests that must also pass before the solution is truly complete.\n\nRefer to the detailed sections below for more information on each step.\n\n## 1. Fetch Provided URLs\n- If the user provides a URL, use the `webfetch` tool to retrieve the content of the provided URL.\n- After fetching, review the content returned by the webfetch tool.\n- If you find any additional URLs or links that are relevant, use the `webfetch` tool again to retrieve those links.\n- Recursively gather all relevant information by fetching additional links until you have all the information you need.\n\n## 2. Deeply Understand the Problem\nCarefully read the issue and think hard about a plan to solve it before coding.\n\n## 3. Codebase Investigation\n- Explore relevant files and directories.\n- Search for key functions, classes, or variables related to the issue.\n- Read and understand relevant code snippets.\n- Identify the root cause of the problem.\n- Validate and update your understanding continuously as you gather more context.\n\n## 4. Internet Research\n- Use the `webfetch` tool to search google by fetching the URL `https://www.google.com/search?q=your+search+query`.\n- After fetching, review the content returned by the fetch tool.\n- You MUST fetch the contents of the most relevant links to gather information. Do not rely on the summary that you find in the search results.\n- As you fetch each link, read the content thoroughly and fetch any additional links that you find withhin the content that are relevant to the problem.\n- Recursively gather all relevant information by fetching links until you have all the information you need.\n\n## 5. Develop a Detailed Plan \n- Outline a specific, simple, and verifiable sequence of steps to fix the problem.\n- Create a todo list in markdown format to track your progress.\n- Each time you complete a step, check it off using `[x]` syntax.\n- Each time you check off a step, display the updated todo list to the user.\n- Make sure that you ACTUALLY continue on to the next step after checkin off a step instead of ending your turn and asking the user what they want to do next.\n\n## 6. Making Code Changes\n- Before editing, always read the relevant file contents or section to ensure complete context.\n- Always read 2000 lines of code at a time to ensure you have enough context.\n- If a patch is not applied correctly, attempt to reapply it.\n- Make small, testable, incremental changes that logically follow from your investigation and plan.\n- Whenever you detect that a project requires an environment variable (such as an API key or secret), always check if a .env file exists in the project root. If it does not exist, automatically create a .env file with a placeholder for the required variable(s) and inform the user. Do this proactively, without waiting for the user to request it.\n\n## 7. Debugging\n- Make code changes only if you have high confidence they can solve the problem\n- When debugging, try to determine the root cause rather than addressing symptoms\n- Debug for as long as needed to identify the root cause and identify a fix\n- Use print statements, logs, or temporary code to inspect program state, including descriptive statements or error messages to understand what's happening\n- To test hypotheses, you can also add test statements or functions\n- Revisit your assumptions if unexpected behavior occurs.\n\n\n# Communication Guidelines\nAlways communicate clearly and concisely in a casual, friendly yet professional tone. \n<examples>\n\"Let me fetch the URL you provided to gather more information.\"\n\"Ok, I've got all of the information I need on the LIFX API and I know how to use it.\"\n\"Now, I will search the codebase for the function that handles the LIFX API requests.\"\n\"I need to update several files here - stand by\"\n\"OK! Now let's run the tests to make sure everything is working correctly.\"\n\"Whelp - I see we have some problems. Let's fix those up.\"\n</examples>\n\n- Respond with clear, direct answers. Use bullet points and code blocks for structure. - Avoid unnecessary explanations, repetition, and filler. \n- Always write code directly to the correct files.\n- Do not display code to the user unless they specifically ask for it.\n- Only elaborate when clarification is essential for accuracy or user understanding.\n\n# Memory\nYou have a memory that stores information about the user and their preferences. This memory is used to provide a more personalized experience. You can access and update this memory as needed. The memory is stored in a file called `.github/instructions/memory.instruction.md`. If the file is empty, you'll need to create it. \n\nWhen creating a new memory file, you MUST include the following front matter at the top of the file:\n```yaml\n---\napplyTo: '**'\n---\n```\n\nIf the user asks you to remember something or add something to your memory, you can do so by updating the memory file.\n\n# Reading Files and Folders\n\n**Always check if you have already read a file, folder, or workspace structure before reading it again.**\n\n- If you have already read the content and it has not changed, do NOT re-read it.\n- Only re-read files or folders if:\n - You suspect the content has changed since your last read.\n - You have made edits to the file or folder.\n - You encounter an error that suggests the context may be stale or incomplete.\n- Use your internal memory and previous context to avoid redundant reads.\n- This will save time, reduce unnecessary operations, and make your workflow more efficient.\n\n# Writing Prompts\nIf you are asked to write a prompt, you should always generate the prompt in markdown format.\n\nIf you are not writing the prompt in a file, you should always wrap the prompt in triple backticks so that it is formatted correctly and can be easily copied from the chat.\n\nRemember that todo lists must always be written in markdown format and must always be wrapped in triple backticks.\n\n# Git \nIf the user tells you to stage and commit, you may do so. \n\nYou are NEVER allowed to stage and commit files automatically.\n"},{"role":"system","content":"Here is some useful information about the environment you are running in:\n<env>\n Working directory: /Users/tnorlund\n Is directory a git repo: no\n Platform: darwin\n Today's date: Sat Sep 06 2025\n</env>\n<project>\n \n</project>"},{"role":"user","content":"hello"}],"tools":[{"type":"function","function":{"name":"bash","description":"Executes a given bash command in a persistent shell session with optional timeout, ensuring proper handling and security measures.\n\nBefore executing the command, please follow these steps:\n\n1. Directory Verification:\n - If the command will create new directories or files, first use the LS tool to verify the parent directory exists and is the correct location\n - For example, before running \"mkdir foo/bar\", first use LS to check that \"foo\" exists and is the intended parent directory\n\n2. Command Execution:\n - Always quote file paths that contain spaces with double quotes (e.g., cd \"path with spaces/file.txt\")\n - Examples of proper quoting:\n - cd \"/Users/name/My Documents\" (correct)\n - cd /Users/name/My Documents (incorrect - will fail)\n - python \"/path/with spaces/script.py\" (correct)\n - python /path/with spaces/script.py (incorrect - will fail)\n - After ensuring proper quoting, execute the command.\n - Capture the output of the command.\n\nUsage notes:\n - The command argument is required.\n - You can specify an optional timeout in milliseconds (up to 600000ms / 10 minutes). If not specified, commands will timeout after 120000ms (2 minutes).\n - It is very helpful if you write a clear, concise description of what this command does in 5-10 words.\n - If the output exceeds 30000 characters, output will be truncated before being returned to you.\n - VERY IMPORTANT: You MUST avoid using search commands like `find` and `grep`. Instead use Grep, Glob, or Task to search. You MUST avoid read tools like `cat`, `head`, `tail`, and `ls`, and use Read and LS to read files.\n - If you _still_ need to run `grep`, STOP. ALWAYS USE ripgrep at `rg` (or /usr/bin/rg) first, which all opencode users have pre-installed.\n - When issuing multiple commands, use the ';' or '&&' operator to separate them. DO NOT use newlines (newlines are ok in quoted strings).\n - Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of `cd`. You may use `cd` if the User explicitly requests it.\n <good-example>\n pytest /foo/bar/tests\n </good-example>\n <bad-example>\n cd /foo/bar && pytest tests\n </bad-example>\n\n\n# Committing changes with git\n\nWhen the user asks you to create a new git commit, follow these steps carefully:\n\n1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel, each using the Bash tool:\n - Run a git status command to see all untracked files.\n - Run a git diff command to see both staged and unstaged changes that will be committed.\n - Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.\n\n2. Analyze all staged changes (both previously staged and newly added) and draft a commit message. Wrap your analysis process in <commit_analysis> tags:\n\n<commit_analysis>\n- List the files that have been changed or added\n- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)\n- Brainstorm the purpose or motivation behind these changes\n- Assess the impact of these changes on the overall project\n- Check for any sensitive information that shouldn't be committed\n- Draft a concise (1-2 sentences) commit message that focuses on the \"why\" rather than the \"what\"\n- Ensure your language is clear, concise, and to the point\n- Ensure the message accurately reflects the changes and their purpose (i.e. \"add\" means a wholly new feature, \"update\" means an enhancement to an existing feature, \"fix\" means a bug fix, etc.)\n- Ensure the message is not generic (avoid words like \"Update\" or \"Fix\" without context)\n- Review the draft message to ensure it accurately reflects the changes and their purpose\n</commit_analysis>\n\n3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:\n - Add relevant untracked files to the staging area.\n - Run git status to make sure the commit succeeded.\n\n4. If the commit fails due to pre-commit hook changes, retry the commit ONCE to include these automated changes. If it fails again, it usually means a pre-commit hook is preventing the commit. If the commit succeeds but you notice that files were modified by the pre-commit hook, you MUST amend your commit to include them.\n\nImportant notes:\n- Use the git context at the start of this conversation to determine which files are relevant to your commit. Be careful not to stage and commit files (e.g. with `git add .`) that aren't relevant to your commit.\n- NEVER update the git config\n- DO NOT run additional commands to read or explore code, beyond what is available in the git context\n- DO NOT push to the remote repository\n- IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.\n- If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit\n- Ensure your commit message is meaningful and concise. It should explain the purpose of the changes, not just describe them.\n- Return an empty response - the user will see the git output directly\n\n# Creating pull requests\nUse the gh command via the Bash tool for ALL GitHub-related tasks including working with issues, pull requests, checks, and releases. If given a Github URL use the gh command to get the information needed.\n\nIMPORTANT: When the user asks you to create a pull request, follow these steps carefully:\n\n1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel using the Bash tool, in order to understand the current state of the branch since it diverged from the main branch:\n - Run a git status command to see all untracked files\n - Run a git diff command to see both staged and unstaged changes that will be committed\n - Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote\n - Run a git log command and `git diff main...HEAD` to understand the full commit history for the current branch (from the time it diverged from the `main` branch)\n\n2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary. Wrap your analysis process in <pr_analysis> tags:\n\n<pr_analysis>\n- List the commits since diverging from the main branch\n- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)\n- Brainstorm the purpose or motivation behind these changes\n- Assess the impact of these changes on the overall project\n- Do not use tools to explore code, beyond what is available in the git context\n- Check for any sensitive information that shouldn't be committed\n- Draft a concise (1-2 bullet points) pull request summary that focuses on the \"why\" rather than the \"what\"\n- Ensure the summary accurately reflects all changes since diverging from the main branch\n- Ensure your language is clear, concise, and to the point\n- Ensure the summary accurately reflects the changes and their purpose (ie. \"add\" means a wholly new feature, \"update\" means an enhancement to an existing feature, \"fix\" means a bug fix, etc.)\n- Ensure the summary is not generic (avoid words like \"Update\" or \"Fix\" without context)\n- Review the draft summary to ensure it accurately reflects the changes and their purpose\n</pr_analysis>\n\n3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:\n - Create new branch if needed\n - Push to remote with -u flag if needed\n - Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.\n<example>\ngh pr create --title \"the pr title\" --body \"$(cat <<'EOF'\n## Summary\n<1-3 bullet points>\nEOF\n)\"\n</example>\n\nImportant:\n- NEVER update the git config\n- Return the PR URL when you're done, so the user can see it\n\n# Other common operations\n- View comments on a Github PR: gh api repos/foo/bar/pulls/123/comments\n","parameters":{"type":"object","properties":{"command":{"type":"string","description":"The command to execute"},"timeout":{"type":"number","description":"Optional timeout in milliseconds"},"description":{"type":"string","description":"Clear, concise description of what this command does in 5-10 words. Examples:\nInput: ls\nOutput: Lists files in current directory\n\nInput: git status\nOutput: Shows working tree status\n\nInput: npm install\nOutput: Installs package dependencies\n\nInput: mkdir foo\nOutput: Creates directory 'foo'"}},"required":["command","description"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"edit","description":"Performs exact string replacements in files. \n\nUsage:\n- You must use your `Read` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file. \n- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the oldString or newString.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.\n- The edit will FAIL if `oldString` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use `replaceAll` to change every instance of `oldString`. \n- Use `replaceAll` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.\n","parameters":{"type":"object","properties":{"filePath":{"type":"string","description":"The absolute path to the file to modify"},"oldString":{"type":"string","description":"The text to replace"},"newString":{"type":"string","description":"The text to replace it with (must be different from oldString)"},"replaceAll":{"type":"boolean","description":"Replace all occurrences of oldString (default false)"}},"required":["filePath","oldString","newString"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"webfetch","description":"- Fetches content from a specified URL\n- Takes a URL and a prompt as input\n- Fetches the URL content, converts HTML to markdown\n- Returns the model's response about the content\n- Use this tool when you need to retrieve and analyze web content\n\nUsage notes:\n - IMPORTANT: If an MCP-provided web fetch tool is available, prefer using that tool instead of this one, as it may have fewer restrictions. All MCP-provided tools start with \"mcp__\".\n - The URL must be a fully-formed valid URL\n - HTTP URLs will be automatically upgraded to HTTPS\n - The prompt should describe what information you want to extract from the page\n - This tool is read-only and does not modify any files\n - Results may be summarized if the content is very large\n - Includes a self-cleaning 15-minute cache for faster responses when repeatedly accessing the same URL\n","parameters":{"type":"object","properties":{"url":{"type":"string","description":"The URL to fetch content from"},"format":{"type":"string","enum":["text","markdown","html"],"description":"The format to return the content in (text, markdown, or html)"},"timeout":{"type":"number","description":"Optional timeout in seconds (max 120)"}},"required":["url","format"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"glob","description":"- Fast file pattern matching tool that works with any codebase size\n- Supports glob patterns like \"**/*.js\" or \"src/**/*.ts\"\n- Returns matching file paths sorted by modification time\n- Use this tool when you need to find files by name patterns\n- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead\n- You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.\n","parameters":{"type":"object","properties":{"pattern":{"type":"string","description":"The glob pattern to match files against"},"path":{"type":"string","description":"The directory to search in. If not specified, the current working directory will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter \"undefined\" or \"null\" - simply omit it for the default behavior. Must be a valid directory path if provided."}},"required":["pattern"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"grep","description":"- Fast content search tool that works with any codebase size\n- Searches file contents using regular expressions\n- Supports full regex syntax (eg. \"log.*Error\", \"function\\s+\\w+\", etc.)\n- Filter files by pattern with the include parameter (eg. \"*.js\", \"*.{ts,tsx}\")\n- Returns file paths with at least one match sorted by modification time\n- Use this tool when you need to find files containing specific patterns\n- If you need to identify/count the number of matches within files, use the Bash tool with `rg` (ripgrep) directly. Do NOT use `grep`.\n- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead\n","parameters":{"type":"object","properties":{"pattern":{"type":"string","description":"The regex pattern to search for in file contents"},"path":{"type":"string","description":"The directory to search in. Defaults to the current working directory."},"include":{"type":"string","description":"File pattern to include in the search (e.g. \"*.js\", \"*.{ts,tsx}\")"}},"required":["pattern"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"list","description":"Lists files and directories in a given path. The path parameter must be an absolute path, not a relative path. You can optionally provide an array of glob patterns to ignore with the ignore parameter. You should generally prefer the Glob and Grep tools, if you know which directories to search.\n","parameters":{"type":"object","properties":{"path":{"type":"string","description":"The absolute path to the directory to list (must be absolute, not relative)"},"ignore":{"type":"array","items":{"type":"string"},"description":"List of glob patterns to ignore"}},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"read","description":"Reads a file from the local filesystem. You can access any file directly by using this tool.\nAssume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.\n\nUsage:\n- The filePath parameter must be an absolute path, not a relative path\n- By default, it reads up to 2000 lines starting from the beginning of the file\n- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters\n- Any lines longer than 2000 characters will be truncated\n- Results are returned using cat -n format, with line numbers starting at 1\n- This tool cannot read binary files, including images\n- You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful. \n- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.\n","parameters":{"type":"object","properties":{"filePath":{"type":"string","description":"The path to the file to read"},"offset":{"type":"number","description":"The line number to start reading from (0-based)"},"limit":{"type":"number","description":"The number of lines to read (defaults to 2000)"}},"required":["filePath"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"write","description":"Writes a file to the local filesystem.\n\nUsage:\n- This tool will overwrite the existing file if there is one at the provided path.\n- If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.\n- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.\n- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.\n- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.\n","parameters":{"type":"object","properties":{"filePath":{"type":"string","description":"The absolute path to the file to write (must be absolute, not relative)"},"content":{"type":"string","description":"The content to write to the file"}},"required":["filePath","content"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"todowrite","description":"Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.\nIt also helps the user understand the progress of the task and overall progress of their requests.\n\n## When to Use This Tool\nUse this tool proactively in these scenarios:\n\n1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions\n2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations\n3. User explicitly requests todo list - When the user directly asks you to use the todo list\n4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)\n5. After receiving new instructions - Immediately capture user requirements as todos. Feel free to edit the todo list based on new information.\n6. After completing a task - Mark it complete and add any new follow-up tasks\n7. When you start working on a new task, mark the todo as in_progress. Ideally you should only have one todo as in_progress at a time. Complete existing tasks before starting new ones.\n\n## When NOT to Use This Tool\n\nSkip using this tool when:\n1. There is only a single, straightforward task\n2. The task is trivial and tracking it provides no organizational benefit\n3. The task can be completed in less than 3 trivial steps\n4. The task is purely conversational or informational\n\nNOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.\n\n## Examples of When to Use the Todo List\n\n<example>\nUser: I want to add a dark mode toggle to the application settings. Make sure you run the tests and build when you're done!\nAssistant: I'll help add a dark mode toggle to your application settings. Let me create a todo list to track this implementation.\n*Creates todo list with the following items:*\n1. Create dark mode toggle component in Settings page\n2. Add dark mode state management (context/store)\n3. Implement CSS-in-JS styles for dark theme\n4. Update existing components to support theme switching\n5. Run tests and build process, addressing any failures or errors that occur\n*Begins working on the first task*\n\n<reasoning>\nThe assistant used the todo list because:\n1. Adding dark mode is a multi-step feature requiring UI, state management, and styling changes\n2. The user explicitly requested tests and build be run afterward\n3. The assistant inferred that tests and build need to pass by adding \"Ensure tests and build succeed\" as the final task\n</reasoning>\n</example>\n\n<example>\nUser: Help me rename the function getCwd to getCurrentWorkingDirectory across my project\nAssistant: Let me first search through your codebase to find all occurrences of 'getCwd'.\n*Uses grep or search tools to locate all instances of getCwd in the codebase*\nAssistant: I've found 15 instances of 'getCwd' across 8 different files. Let me create a todo list to track these changes.\n*Creates todo list with specific items for each file that needs updating*\n\n<reasoning>\nThe assistant used the todo list because:\n1. First, the assistant searched to understand the scope of the task\n2. Upon finding multiple occurrences across different files, it determined this was a complex task with multiple steps\n3. The todo list helps ensure every instance is tracked and updated systematically\n4. This approach prevents missing any occurrences and maintains code consistency\n</reasoning>\n</example>\n\n\n<example>\nUser: I need to implement these features for my e-commerce site: user registration, product catalog, shopping cart, and checkout flow.\nAssistant: I'll help implement these features. First, let's add all the features to the todo list.\n*Creates a todo list breaking down each feature into specific tasks based on the project architecture*\nAssistant: Let's start with user registration. This will involve creating database models, API endpoints, and frontend forms that integrate with your existing authentication system.\n\n<reasoning>\nThe assistant used the todo list because:\n1. The user provided multiple complex features to implement in a comma separated list\n2. The todo list helps organize these large features into manageable tasks\n3. This approach allows for tracking progress across the entire implementation\n</reasoning>\n</example>\n\n<example>\nUser: Can you help optimize my React application? It's rendering slowly and has performance issues.</user>\nAssistant: I'll help optimize your React application. First, let me examine your codebase to identify potential performance bottlenecks.\n*Reviews component structure, render patterns, state management, and data fetching*\nAssistant: After analyzing your codebase, I've identified several performance issues. Let me create a todo list to track our optimization efforts.\n*Creates todo list with items like: 1) Implement memoization for expensive calculations in ProductList, 2) Add virtualization for long lists in Dashboard, 3) Optimize image loading in Gallery component, 4) Fix state update loops in ShoppingCart, 5) Review bundle size and implement code splitting*\nLet's start by implementing memoization for the expensive calculations in your ProductList component.</assistant>\n\n<reasoning>\nThe assistant used the todo list because:\n1. First, the assistant examined the codebase to identify specific performance issues\n2. Based on this analysis, it identified multiple optimization opportunities\n3. Performance optimization is a non-trivial task requiring multiple steps\n4. The todo list helps methodically track improvements across different components\n5. This systematic approach ensures all performance bottlenecks are addressed\n</reasoning>\n</example>\n\n## Examples of When NOT to Use the Todo List\n\n<example>\nUser: How do I print 'Hello World' in Python?\nAssistant: In Python, you can print \"Hello World\" with this simple code:\n\npython\nprint(\"Hello World\")\n\nThis will output the text \"Hello World\" to the console when executed.</assistant>\n\n<reasoning>\nThe assistant did not use the todo list because this is a single, trivial task that can be completed in one step. There's no need to track multiple tasks or steps for such a straightforward request.\n</reasoning>\n</example>\n\n<example>\nUser: What does the git status command do?\nAssistant: The git status command shows the current state of your working directory and staging area. It displays which changes have been staged, which haven't, and which files aren't being tracked by Git. This is a fundamental command for understanding the current state of your repository before making commits.\n\n<reasoning>\nThe assistant did not use the todo list because this is an informational request with no actual coding task to complete. The user is simply asking for an explanation, not for the assistant to perform multiple steps or tasks.\n</reasoning>\n</example>\n\n<example>\nUser: Can you add a comment to the calculateTotal function to explain what it does?\nAssistant: Sure, let me add a comment to the calculateTotal function to explain what it does.\n* Uses the Edit tool to add a comment to the calculateTotal function *\n\n<reasoning>\nThe assistant did not use the todo list because this is a single, straightforward task confined to one location in the code. Adding a comment doesn't require tracking multiple steps or systematic organization.\n</reasoning>\n</example>\n\n<example>\nUser: Run npm install for me and tell me what happens.\nAssistant: I'll run the npm install command for you.\n\n*Executes: npm install*\n\nThe command completed successfully. Here's the output:\n[Output of npm install command]\n\nAll dependencies have been installed according to your package.json file.\n\n<reasoning>\nThe assistant did not use the todo list because this is a single command execution with immediate results. There are no multiple steps to track or organize, making the todo list unnecessary for this straightforward task.\n</reasoning>\n</example>\n\n## Task States and Management\n\n1. **Task States**: Use these states to track progress:\n - pending: Task not yet started\n - in_progress: Currently working on (limit to ONE task at a time)\n - completed: Task finished successfully\n - cancelled: Task no longer needed\n\n2. **Task Management**:\n - Update task status in real-time as you work\n - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)\n - Only have ONE task in_progress at any time\n - Complete current tasks before starting new ones\n - Cancel tasks that become irrelevant\n\n3. **Task Breakdown**:\n - Create specific, actionable items\n - Break complex tasks into smaller, manageable steps\n - Use clear, descriptive task names\n\nWhen in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.\n\n","parameters":{"type":"object","properties":{"todos":{"type":"array","items":{"type":"object","properties":{"content":{"type":"string","description":"Brief description of the task"},"status":{"type":"string","description":"Current status of the task: pending, in_progress, completed, cancelled"},"priority":{"type":"string","description":"Priority level of the task: high, medium, low"},"id":{"type":"string","description":"Unique identifier for the todo item"}},"required":["content","status","priority","id"],"additionalProperties":false},"description":"The updated todo list"}},"required":["todos"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"todoread","description":"Use this tool to read your todo list","parameters":{"type":"object","properties":{},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}},{"type":"function","function":{"name":"task","description":"Launch a new agent to handle complex, multi-step tasks autonomously.\n\nAvailable agent types and the tools they have access to:\n- general: General-purpose agent for researching complex questions, searching for code, and executing multi-step tasks. When you are searching for a keyword or file and are not confident that you will find the right match in the first few tries use this agent to perform the search for you.\n\nWhen using the Task tool, you must specify a subagent_type parameter to select which agent type to use.\n\nWhen to use the Agent tool:\n- When you are instructed to execute custom slash commands. Use the Agent tool with the slash command invocation as the entire prompt. The slash command can take arguments. For example: Task(description=\"Check the file\", prompt=\"/check-file path/to/file.py\")\n\nWhen NOT to use the Agent tool:\n- If you want to read a specific file path, use the Read or Glob tool instead of the Agent tool, to find the match more quickly\n- If you are searching for a specific class definition like \"class Foo\", use the Glob tool instead, to find the match more quickly\n- If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Agent tool, to find the match more quickly\n- Other tasks that are not related to the agent descriptions above\n\n\nUsage notes:\n1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses\n2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.\n3. Each agent invocation is stateless. You will not be able to send additional messages to the agent, nor will the agent be able to communicate with you outside of its final report. Therefore, your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.\n4. The agent's outputs should generally be trusted\n5. Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent\n6. If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.\n\nExample usage (NOTE: The agents below are fictional examples for illustration only - use the actual agents listed above):\n\n<example_agent_descriptions>\n\"code-reviewer\": use this agent after you are done writing a signficant piece of code\n\"greeting-responder\": use this agent when to respond to user greetings with a friendly joke\n</example_agent_description>\n\n<example>\nuser: \"Please write a function that checks if a number is prime\"\nassistant: Sure let me write a function that checks if a number is prime\nassistant: First let me use the Write tool to write a function that checks if a number is prime\nassistant: I'm going to use the Write tool to write the following code:\n<code>\nfunction isPrime(n) {\n if (n <= 1) return false\n for (let i = 2; i * i <= n; i++) {\n if (n % i === 0) return false\n }\n return true\n}\n</code>\n<commentary>\nSince a signficant piece of code was written and the task was completed, now use the code-reviewer agent to review the code\n</commentary>\nassistant: Now let me use the code-reviewer agent to review the code\nassistant: Uses the Task tool to launch the code-reviewer agent\n</example>\n\n<example>\nuser: \"Hello\"\n<commentary>\nSince the user is greeting, use the greeting-responder agent to respond with a friendly joke\n</commentary>\nassistant: \"I'm going to use the Task tool to launch the with the greeting-responder agent\"\n</example>\n","parameters":{"type":"object","properties":{"description":{"type":"string","description":"A short (3-5 words) description of the task"},"prompt":{"type":"string","description":"The task for the agent to perform"},"subagent_type":{"type":"string","description":"The type of specialized agent to use for this task"}},"required":["description","prompt","subagent_type"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}],"tool_choice":"auto","stream":true},"statusCode":404,"responseHeaders":{"alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000","content-type":"text/html; charset=utf-8","date":"Sat, 06 Sep 2025 22:13:14 GMT","transfer-encoding":"chunked","via":"1.1 google","x-build-commit":"5669830f84f981009e2ea28ba3c01fd564ab374c","x-build-time":"1757031932","x-frame-options":"DENY","x-request-id":"713d9ead-e5be-4535-b0e1-6931ecfda9d6","set-cookie":"aid=7ee21399-b25e-4c26-a2d2-20de970683ea; Path=/; Max-Age=31536000; HttpOnly; Secure; SameSite=Lax"},"responseBody":"\n\n\n\n\n\n\n<!doctype html>\n<html class=\"h-full overflow-y-scroll\">\n <head>\n <title>Ollama</title>\n\n <meta charset=\"utf-8\" />\n <meta name=\"description\" content=\"Get up and running with large language models.\"/>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <meta property=\"og:title\" content=\"Ollama\" />\n <meta property=\"og:description\" content=\"Get up and running with large language models.\" />\n <meta property=\"og:url\" content=\"https://ollama.com\" />\n <meta property=\"og:image\" content=\"https://ollama.com/public/og.png\" />\n <meta property=\"og:image:type\" content=\"image/png\" />\n <meta property=\"og:image:width\" content=\"1200\" />\n <meta property=\"og:image:height\" content=\"628\" />\n <meta property=\"og:type\" content=\"website\" />\n\n <meta name=\"robots\" content=\"index, follow\" />\n\n <meta property=\"twitter:card\" content=\"summary\" />\n <meta property=\"twitter:title\" content=\"Ollama\" />\n <meta property=\"twitter:description\" content=\"Get up and running with large language models.\" />\n <meta property=\"twitter:site\" content=\"ollama\" />\n\n <meta property=\"twitter:image:src\" content=\"https://ollama.com/public/og-twitter.png\" />\n <meta property=\"twitter:image:width\" content=\"1200\" />\n <meta property=\"twitter:image:height\" content=\"628\" />\n\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1\">\n\n <link rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/public/icon-16x16.png\" />\n <link rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/public/icon-32x32.png\" />\n <link rel=\"icon\" type=\"image/png\" sizes=\"48x48\" href=\"/public/icon-48x48.png\" />\n <link rel=\"icon\" type=\"image/png\" sizes=\"64x64\" href=\"/public/icon-64x64.png\" />\n <link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"/public/apple-touch-icon.png\" />\n <link rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/public/android-chrome-icon-192x192.png\" />\n <link rel=\"icon\" type=\"image/png\" sizes=\"512x512\" href=\"/public/android-chrome-icon-512x512.png\" />\n\n \n \n\n <link href=\"/public/tailwind.css?v=62f47bdec326e80b8b5a49551dfb2f03\" rel=\"stylesheet\" />\n <script type=\"application/ld+json\">\n {\n \"@context\": \"https://schema.org\",\n \"@type\": \"WebSite\",\n \"name\": \"Ollama\",\n \"url\": \"https://ollama.com\"\n }\n </script>\n\n <script type=\"text/javascript\">\n function copyToClipboard(element) {\n let commandElement = null;\n const preElement = element.closest('pre');\n const languageNoneElement = element.closest('.language-none');\n\n if (preElement) {\n commandElement = preElement.querySelector('code');\n } else if (languageNoneElement) {\n commandElement = languageNoneElement.querySelector('.command');\n } else {\n const parent = element.parentElement;\n if (parent) {\n commandElement = parent.querySelector('.command');\n }\n }\n\n if (!commandElement) {\n console.error('No code or command element found');\n return;\n }\n\n const code = commandElement.textContent ? commandElement.textContent.trim() : commandElement.value;\n\n navigator.clipboard\n .writeText(code)\n .then(() => {\n const copyIcon = element.querySelector('.copy-icon')\n const checkIcon = element.querySelector('.check-icon')\n\n copyIcon.classList.add('hidden')\n checkIcon.classList.remove('hidden')\n\n setTimeout(() => {\n copyIcon.classList.remove('hidden')\n checkIcon.classList.add('hidden')\n }, 2000)\n })\n }\n </script>\n \n <script>\n \n function getIcon(url) {\n url = url.toLowerCase();\n if (url.includes('x.com') || url.includes('twitter.com')) return 'x';\n if (url.includes('github.com')) return 'github';\n if (url.includes('linkedin.com')) return 'linkedin';\n if (url.includes('youtube.com')) return 'youtube';\n if (url.includes('hf.co') || url.includes('huggingface.co') || url.includes('huggingface.com')) return 'hugging-face';\n return 'default';\n }\n\n function setInputIcon(input) {\n const icon = getIcon(input.value);\n const img = input.previousElementSibling.querySelector('img');\n img.src = `/public/social/${icon}.svg`;\n img.alt = `${icon} icon`;\n }\n\n function setDisplayIcon(imgElement, url) {\n const icon = getIcon(url);\n imgElement.src = `/public/social/${icon}.svg`;\n imgElement.alt = `${icon} icon`;\n }\n </script>\n \n <script src=\"/public/vendor/htmx/bundle.js\"></script>\n \n </head>\n\n <body\n class=\"\n antialiased\n min-h-screen\n w-full\n m-0\n flex\n flex-col\n \"\n hx-on:keydown=\"\n if (event.target.tagName === 'INPUT' || event.target.tagName === 'TEXTAREA') {\n // Ignore key events in input fields.\n return;\n }\n if ((event.metaKey && event.key === 'k') || event.key === '/') {\n event.preventDefault();\n const sp = htmx.find('#search') || htmx.find('#navbar-input');\n sp.focus();\n }\n \"\n >\n \n<header class=\"sticky top-0 z-40 bg-white underline-offset-4 lg:static\">\n <nav class=\"flex w-full items-center justify-between px-6 py-3.5\">\n <a href=\"/\" class=\"z-50\">\n <img src=\"/public/ollama.png\" class=\"w-8\" alt=\"Ollama\" />\n </a>\n \n \n <div class=\"hidden lg:flex xl:flex-1 items-center space-x-6 ml-6 mr-6 xl:mr-0 text-lg\">\n <a class=\"hover:underline focus:underline focus:outline-none focus:ring-0\" href=\"/models\">Models</a>\n <a class=\"hover:underline focus:underline focus:outline-none focus:ring-0\" href=\"https://github.com/ollama/ollama\">GitHub</a>\n <a class=\"hover:underline focus:underline focus:outline-none focus:ring-0\" href=\"https://discord.gg/ollama\">Discord</a>\n <a class=\"hover:underline focus:underline focus:outline-none focus:ring-0\" href=\"/turbo\">Turbo</a>\n </div>\n\n \n <div class=\"flex-grow justify-center items-center hidden lg:flex xl:-ml-8\">\n <div class=\"relative w-full xl:max-w-[28rem]\">\n \n<form action=\"/search\" autocomplete=\"off\">\n <div \n class=\"relative flex w-full appearance-none bg-black/5 border border-neutral-100 items-center rounded-full\"\n hx-on:focusout=\"\n if (!this.contains(event.relatedTarget)) {\n const searchPreview = document.querySelector('#searchpreview');\n if (searchPreview) {\n htmx.addClass('#searchpreview', 'hidden');\n }\n }\n \"\n >\n <span id=\"searchIcon\" class=\"pl-2 text-2xl text-neutral-500\">\n <svg class=\"mt-0.25 ml-1.5 h-5 w-5 fill-current\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"m8.5 3c3.0375661 0 5.5 2.46243388 5.5 5.5 0 1.24832096-.4158777 2.3995085-1.1166416 3.3225711l4.1469717 4.1470988c.2928932.2928932.2928932.767767 0 1.0606602-.2662666.2662665-.6829303.2904726-.9765418.0726181l-.0841184-.0726181-4.1470988-4.1469717c-.9230626.7007639-2.07425014 1.1166416-3.3225711 1.1166416-3.03756612 0-5.5-2.4624339-5.5-5.5 0-3.03756612 2.46243388-5.5 5.5-5.5zm0 1.5c-2.209139 0-4 1.790861-4 4s1.790861 4 4 4 4-1.790861 4-4-1.790861-4-4-4z\" />\n </svg>\n </span>\n <input\n id=\"search\"\n hx-get=\"/search\"\n hx-trigger=\"keyup changed delay:100ms, focus\"\n hx-target=\"#searchpreview\"\n hx-swap=\"innerHTML\"\n name=\"q\"\n class=\"resize-none rounded-full border-0 py-2.5 bg-transparent text-sm w-full placeholder:text-neutral-500 focus:outline-none focus:ring-0\"\n placeholder=\"Search models\"\n autocomplete=\"off\"\n hx-on:keydown=\"\n if (event.key === 'Enter') {\n event.preventDefault();\n window.location.href = '/search?q=' + encodeURIComponent(this.value);\n return;\n }\n if (event.key === 'Escape') {\n event.preventDefault();\n this.value = '';\n this.blur();\n htmx.addClass('#searchpreview', 'hidden');\n return;\n }\n if (event.key === 'Tab') { \n htmx.addClass('#searchpreview', 'hidden');\n return;\n }\n if (event.key === 'ArrowDown') {\n let first = document.querySelector('#search-preview-list a:first-of-type');\n first?.focus();\n event.preventDefault();\n }\n if (event.key === 'ArrowUp') {\n let last = document.querySelector('#view-all-link');\n last?.focus();\n event.preventDefault();\n }\n htmx.removeClass('#searchpreview', 'hidden');\n \"\n hx-on:focus=\"\n htmx.removeClass('#searchpreview', 'hidden')\n \"\n />\n</form>\n<div id=\"searchpreview\" class=\"hidden absolute left-0 right-0 top-12 z-50\" style=\"width: calc(100% + 2px); margin-left: -1px;\"></div>\n</div>\n\n </div>\n </div>\n\n \n <div class=\"hidden lg:flex xl:flex-1 items-center space-x-2 justify-end ml-6 xl:ml-0\">\n \n <a class=\"flex cursor-pointer items-center rounded-full bg-black/5 hover:bg-black/10 text-lg px-4 py-1.5 text-black whitespace-nowrap\" href=\"/signin\">Sign in</a>\n <a class=\"flex cursor-pointer items-center rounded-full bg-neutral-800 text-lg px-4 py-1.5 text-white hover:bg-black whitespace-nowrap focus:bg-black\" href=\"/download\">Download</a>\n \n </div>\n \n \n <div class=\"lg:hidden flex items-center\">\n <input type=\"checkbox\" id=\"menu\" class=\"peer hidden\" />\n <label for=\"menu\" class=\"z-50 cursor-pointer peer-checked:hidden block\">\n <svg\n class=\"h-8 w-8\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke-width=\"1.5\"\n stroke=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5\"\n />\n </svg>\n </label>\n <label for=\"menu\" class=\"z-50 cursor-pointer hidden peer-checked:block fixed top-4 right-6\">\n <svg\n class=\"h-8 w-8\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke-width=\"1.5\"\n stroke=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </label>\n \n <div class=\"fixed inset-0 bg-white z-40 hidden peer-checked:block overflow-y-auto\">\n <div class=\"flex flex-col space-y-5 pt-[5.5rem] text-3xl\">\n \n <a class=\"px-6\" href=\"/models\">Models</a>\n\n \n <a class=\"px-6\" href=\"/download\">Download</a>\n <a class=\"px-6\" href=\"https://github.com/ollama/ollama\">GitHub</a>\n <a class=\"px-6\" href=\"https://discord.gg/ollama\">Discord</a>\n\n \n <a href=\"/signin\" class=\"block px-6\">Sign in</a>\n \n\n \n </div>\n </div>\n </div>\n </nav>\n</header>\n\n\n <main class=\"mx-auto flex max-w-4xl flex-1 flex-col-reverse items-center justify-center p-32 md:flex-row md:items-start md:justify-between\">\n <div class=\"space-y-2 text-center md:pt-6 md:text-left\">\n <h2 class=\"text-3xl font-normal tracking-tight md:text-4xl\">\n 404.\n <span class=\"text-neutral-400\"> That's an error. </span>\n </h2>\n <p class=\"text-center text-lg md:text-left md:text-xl\">\n The page was not found.\n </p>\n </div>\n <div class=\"pb-4 md:pb-0\">\n <img src=\"/public/400s.svg\" class=\"w-40 md:w-48\" alt=\"400s ollama\" />\n </div>\n</main>\n\n \n<footer class=\"mt-auto\">\n <div class=\"bg-white underline-offset-4 hidden md:block\">\n <div class=\"flex items-center justify-between px-6 py-3.5\">\n <div class=\"text-xs text-neutral-500\">© 2025 Ollama</div>\n <div class=\"flex space-x-6 text-xs text-neutral-500\">\n <a href=\"/download\" class=\"hover:underline\">Download</a>\n <a href=\"/blog\" class=\"hover:underline\">Blog</a>\n <a href=\"https://github.com/ollama/ollama/tree/main/docs\" class=\"hover:underline\">Docs</a>\n <a href=\"https://github.com/ollama/ollama\" class=\"hover:underline\">GitHub</a>\n <a href=\"https://discord.com/invite/ollama\" class=\"hover:underline\">Discord</a>\n <a href=\"https://twitter.com/ollama\" class=\"hover:underline\">X (Twitter)</a>\n <a href=\"mailto:hello@ollama.com\" class=\"hover:underline\">Contact Us</a>\n </div>\n </div>\n </div>\n <div class=\"bg-white py-4 md:hidden\">\n <div class=\"flex flex-col items-center justify-center\">\n <ul class=\"flex flex-wrap items-center justify-center text-sm text-neutral-500\">\n <li class=\"mx-2 my-1\">\n <a href=\"/blog\" class=\"hover:underline\">Blog</a>\n </li>\n <li class=\"mx-2 my-1\">\n <a href=\"/download\" class=\"hover:underline\">Download</a>\n </li>\n <li class=\"mx-2 my-1\">\n <a href=\"https://github.com/ollama/ollama/tree/main/docs\" class=\"hover:underline\">Docs</a>\n </li>\n </ul>\n <ul class=\"flex flex-wrap items-center justify-center text-sm text-neutral-500\">\n <li class=\"mx-2 my-1\">\n <a href=\"https://github.com/ollama/ollama\" class=\"hover:underline\">GitHub</a>\n </li>\n <li class=\"mx-2 my-1\">\n <a href=\"https://discord.com/invite/ollama\" class=\"hover:underline\">Discord</a>\n </li>\n <li class=\"mx-2 my-1\">\n <a href=\"https://twitter.com/ollama\" class=\"hover:underline\">X (Twitter)</a>\n </li>\n <li class=\"mx-2 my-1\">\n <a href=\"https://lu.ma/ollama\" class=\"hover:underline\">Meetups</a>\n </li>\n </ul>\n <div class=\"mt-2 flex items-center justify-center text-sm text-neutral-500\">\n © 2025 Ollama Inc.\n </div>\n </div>\n </div>\n</footer>\n\n\n \n <span class=\"hidden\" id=\"end_of_template\"></span>\n </body>\n</html>\n","isRetryable":false}} streamText error INFO 2025-09-06T22:13:14 +3ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx type=error part ERROR 2025-09-06T22:13:14 +0ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx error=Not Found INFO 2025-09-06T22:13:14 +0ms service=bus type=session.error publishing Error: AI_APICallError: Not Found INFO 2025-09-06T22:13:14 +3ms service=bus type=message.updated publishing INFO 2025-09-06T22:13:14 +0ms service=session session=ses_6dee8c941ffeijLTf2QbKU6pVx sessionID=ses_6dee8c941ffeijLTf2QbKU6pVx unlocking INFO 2025-09-06T22:13:14 +2ms service=bus type=session.idle publishing tnorlund@Tylers-MacBook-Pro ~ %```
Author
Owner

@tnorlund commented on GitHub (Sep 6, 2025):

Looks like it's appending stuff to the url

"https://ollama.com/api/chat/chat/completions"
@tnorlund commented on GitHub (Sep 6, 2025): Looks like it's appending stuff to the url ``` "https://ollama.com/api/chat/chat/completions" ```
Author
Owner

@rekram1-node commented on GitHub (Sep 6, 2025):

yeah thats the baseurl issue I was talking about you need to have correct suffix, looks like the /api is needed but the /chat should be removed

@rekram1-node commented on GitHub (Sep 6, 2025): yeah thats the baseurl issue I was talking about you need to have correct suffix, looks like the /api is needed but the /chat should be removed
Author
Owner

@tnorlund commented on GitHub (Sep 6, 2025):

I can drop the "chat" part of the URL, but I end up with the /completions still. Anyway to stop that?

This is what I get with "baseURL": "https://ollama.com/api/", in the config:
https://ollama.com/api/chat/completions

@tnorlund commented on GitHub (Sep 6, 2025): I can drop the "chat" part of the URL, but I end up with the /completions still. Anyway to stop that? This is what I get with `"baseURL": "https://ollama.com/api/",` in the config: ```https://ollama.com/api/chat/completions```
Author
Owner

@tnorlund commented on GitHub (Sep 6, 2025):

Maybe another value for "npm" in the config? It freaks out when I remove it completely.

@tnorlund commented on GitHub (Sep 6, 2025): Maybe another value for "npm" in the config? It freaks out when I remove it completely.
Author
Owner

@rekram1-node commented on GitHub (Sep 6, 2025):

yeah it seems like it doesn't support the openai completions standard

btw turbo is in preview so this will probably change in time

@rekram1-node commented on GitHub (Sep 6, 2025): yeah it seems like it doesn't support the openai completions standard btw turbo is in preview so this will probably change in time
Author
Owner

@tnorlund commented on GitHub (Sep 7, 2025):

What's the workaround?

@tnorlund commented on GitHub (Sep 7, 2025): What's the workaround?
Author
Owner

@anuramat commented on GitHub (Sep 7, 2025):

fyi there's a couple of hacks in https://github.com/ollama/ollama/issues/11768

@anuramat commented on GitHub (Sep 7, 2025): fyi there's a couple of hacks in https://github.com/ollama/ollama/issues/11768
Author
Owner

@tnorlund commented on GitHub (Sep 7, 2025):

fyi there's a couple of hacks in ollama/ollama#11768

Tried it, but it doesn't fix the underlying problem. The issue is that open code adds /chat/completions to the baseURL while the ollama turbo is looking for /api/chat. This is most likely due to the "npm" config:

Troubleshooting
...
2. For custom providers, check the opencode config and:

  • Make sure the provider ID used in opencode auth login matches the ID in your opencode config.
  • The right npm package is used for the provider. For example, use @ai-sdk/cerebras for Cerebras. And for all other OpenAI-compatible providers, use @ai-sdk/openai-compatible.
  • Check correct API endpoint is used in the options.baseURL field.
@tnorlund commented on GitHub (Sep 7, 2025): > fyi there's a couple of hacks in [ollama/ollama#11768](https://github.com/ollama/ollama/issues/11768) Tried it, but it doesn't fix the underlying problem. The issue is that open code adds `/chat/completions` to the baseURL while the ollama turbo is looking for `/api/chat`. This is most likely due to the "npm" config: > [Troubleshooting](https://opencode.ai/docs/providers/#troubleshooting) > ... > 2. For custom providers, check the opencode config and: > - Make sure the provider ID used in opencode auth login matches the ID in your opencode config. > - The right npm package is used for the provider. For example, use @ai-sdk/cerebras for Cerebras. And for all other OpenAI-compatible providers, use @ai-sdk/openai-compatible. > - Check correct API endpoint is used in the options.baseURL field.
Author
Owner

@rekram1-node commented on GitHub (Sep 7, 2025):

This is most likely due to the "npm" config:

turbo isn't openai compatible (yet), and you are trying to use the openai provider, @ai-sdk/openai-compatible uses the openai completions endpoint.

@rekram1-node commented on GitHub (Sep 7, 2025): > This is most likely due to the "npm" config: turbo isn't openai compatible (yet), and you are trying to use the openai provider, @ai-sdk/openai-compatible uses the openai completions endpoint.
Author
Owner

@tnorlund commented on GitHub (Sep 7, 2025):

This is most likely due to the "npm" config:

turbo isn't openai compatible (yet), and you are trying to use the openai provider, @ai-sdk/openai-compatible uses the openai completions endpoint.

Is there an example of how to config something with the specific URL endpoint I'd like to use?

@tnorlund commented on GitHub (Sep 7, 2025): > > This is most likely due to the "npm" config: > > > turbo isn't openai compatible (yet), and you are trying to use the openai provider, @ai-sdk/openai-compatible uses the openai completions endpoint. Is there an example of how to config something with the specific URL endpoint I'd like to use?
Author
Owner

@OpeOginni commented on GitHub (Sep 8, 2025):

Maybe another value for "npm" in the config? It freaks out when I remove it completely.

Hey @tnorlund have you tried using this npm package? ollama-ai-provider-v2. It does say local, but maybe they run it on their side the same way? Yet For the exact base url you might have to try https://ollama.com or https://ollama.com/api.

@OpeOginni commented on GitHub (Sep 8, 2025): > Maybe another value for "npm" in the config? It freaks out when I remove it completely. Hey @tnorlund have you tried using this npm package? [`ollama-ai-provider-v2`](https://github.com/nordwestt/ollama-ai-provider-v2). It does say local, but maybe they run it on their side the same way? Yet For the exact base url you might have to try `https://ollama.com` or `https://ollama.com/api`.
Author
Owner

@tnorlund commented on GitHub (Sep 8, 2025):

hi @OpeOginni! I'm not sure what you mean by the npm package. Do you want me to configure the opencode.json file like this:

...
      "npm": "@ai-sdk/ollama-ai-provider-v2",
...

I tried this and didn't get anything.

@tnorlund commented on GitHub (Sep 8, 2025): hi @OpeOginni! I'm not sure what you mean by the npm package. Do you want me to configure the opencode.json file like this: ``` ... "npm": "@ai-sdk/ollama-ai-provider-v2", ... ``` I tried this and didn't get anything.
Author
Owner

@OpeOginni commented on GitHub (Sep 8, 2025):

@tnorlund Just ollama-ai-provider-v2 not @ai-sdk/ollama-ai-provider-v2

so you should try this

    "ollama": {
      "npm": "ollama-ai-provider-v2",
      "name": "Ollama (turbo)",
      "options": {
        "baseURL": "https://ollama.com/api",
        "headers": {
          "Authorization": "Bearer $OLLAMA_API_KEY"
        }
      }

OR this (changed the baseURL if the first one doesnt work)

    "ollama": {
      "npm": "ollama-ai-provider-v2",
      "name": "Ollama (turbo)",
      "options": {
        "baseURL": "https://ollama.com",
        "headers": {
          "Authorization": "Bearer $OLLAMA_API_KEY"
        }
      }
@OpeOginni commented on GitHub (Sep 8, 2025): @tnorlund Just `ollama-ai-provider-v2` not `@ai-sdk/ollama-ai-provider-v2` so you should try this ```json "ollama": { "npm": "ollama-ai-provider-v2", "name": "Ollama (turbo)", "options": { "baseURL": "https://ollama.com/api", "headers": { "Authorization": "Bearer $OLLAMA_API_KEY" } } ``` OR this (changed the baseURL if the first one doesnt work) ```json "ollama": { "npm": "ollama-ai-provider-v2", "name": "Ollama (turbo)", "options": { "baseURL": "https://ollama.com", "headers": { "Authorization": "Bearer $OLLAMA_API_KEY" } } ```
Author
Owner

@tnorlund commented on GitHub (Sep 8, 2025):

Thanks @OpeOginni ! The following config is the fix:

...
      "npm": "ollama-ai-provider-v2",
...
      "options": {
        "baseURL": "https://ollama.com/api",
...

@tnorlund commented on GitHub (Sep 8, 2025): Thanks @OpeOginni ! The following config is the fix: ``` ... "npm": "ollama-ai-provider-v2", ... "options": { "baseURL": "https://ollama.com/api", ... ```
Author
Owner

@rekram1-node commented on GitHub (Sep 8, 2025):

Awesome, thank you @OpeOginni as always!

@rekram1-node commented on GitHub (Sep 8, 2025): Awesome, thank you @OpeOginni as always!
Author
Owner

@anuramat commented on GitHub (Sep 9, 2025):

is there a way to set reasoning effort? I tried

          "options": {
            "effort": "high",
            "reasoningEffort": "high",
            "reasoning_effort": "high",
            "think": "high"
          },

none of these seem to even end up in the request

@anuramat commented on GitHub (Sep 9, 2025): is there a way to set reasoning effort? I tried ```json "options": { "effort": "high", "reasoningEffort": "high", "reasoning_effort": "high", "think": "high" }, ``` none of these seem to even end up in the request
Author
Owner

@rekram1-node commented on GitHub (Sep 9, 2025):

for what model/provider?

@rekram1-node commented on GitHub (Sep 9, 2025): for what model/provider?
Author
Owner

@rekram1-node commented on GitHub (Sep 9, 2025):

Ig you prolly mean ollama lol this may be helpful: https://github.com/nordwestt/ollama-ai-provider-v2?tab=readme-ov-file#reasoning-mode-thinking

@rekram1-node commented on GitHub (Sep 9, 2025): Ig you prolly mean ollama lol this may be helpful: [https://github.com/nordwestt/ollama-ai-provider-v2?tab=readme-ov-file#reasoning-mode-thinking](https://github.com/nordwestt/ollama-ai-provider-v2?tab=readme-ov-file#reasoning-mode-thinking)
Author
Owner

@anuramat commented on GitHub (Sep 9, 2025):

ollama turbo, both gpt-oss:20b/gpt-oss:120b

@anuramat commented on GitHub (Sep 9, 2025): ollama turbo, both gpt-oss:20b/gpt-oss:120b
Author
Owner

@flacks commented on GitHub (Sep 11, 2025):

is there a way to use the key loaded into auth.json as the token in the Authorization: Bearer $token header for the provider in ~/.config/opencode/opencode.json? or do we either need to hardcode in opencode.json or use an env variable?

@flacks commented on GitHub (Sep 11, 2025): is there a way to use the key loaded into `auth.json` as the token in the `Authorization: Bearer $token` header for the provider in `~/.config/opencode/opencode.json`? or do we either need to hardcode in `opencode.json` or use an env variable?
Author
Owner

@flacks commented on GitHub (Sep 11, 2025):

also, attempting to use deepseek-v3.1:671b results in a Bad Gateway error.

@flacks commented on GitHub (Sep 11, 2025): also, attempting to use `deepseek-v3.1:671b` results in a `Bad Gateway` error.
Author
Owner

@rekram1-node commented on GitHub (Sep 11, 2025):

Can you share your opencode.json and a censored version of the auth.json? censored as in obviously don't show creds maybe just *** then out or something

@rekram1-node commented on GitHub (Sep 11, 2025): Can you share your opencode.json and a censored version of the auth.json? censored as in obviously don't show creds maybe just \*\*\* then out or something
Author
Owner

@anuramat commented on GitHub (Sep 11, 2025):

@flacks you can put the token in a file (e.g. with agenix) and reference it as "{file:/a/b/c}": https://github.com/anuramat/nixos/blob/402d35debcf2b1e30f459c706a5c8d670143d802/home-modules/heavy-linux/agents/frontends/opencode.nix#L66

@anuramat commented on GitHub (Sep 11, 2025): @flacks you can put the token in a file (e.g. with agenix) and reference it as `"{file:/a/b/c}"`: https://github.com/anuramat/nixos/blob/402d35debcf2b1e30f459c706a5c8d670143d802/home-modules/heavy-linux/agents/frontends/opencode.nix#L66
Author
Owner

@flacks commented on GitHub (Sep 11, 2025):

@anuramat holy cow, you are hardcore, thank you so much, gonna check out the rest of your nix config, too!!

@flacks commented on GitHub (Sep 11, 2025): @anuramat holy cow, you are hardcore, thank you so much, gonna check out the rest of your nix config, too!!
Author
Owner

@flacks commented on GitHub (Sep 11, 2025):

@rekram1-node

opencode.jsonc

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "ollama": {
      "npm": "ollama-ai-provider-v2",
      "name": "Ollama Turbo",
      "options": {
        "baseURL": "https://ollama.com/api",
        "headers": {
          "Authorization": "Bearer ***"
        }
      },
      "models": {
        "gpt-oss:20b": {
          "name": "GPT-OSS 20B"
        },
        "gpt-oss:120b": {
          "name": "GPT-OSS 120B"
        },
        "deepseek-v3.1:671b": {
          "name": "DeepSeek-V3.1 671B"
        }
      }
    }
  },
  "model": "gpt-oss:120b"
}

auth.json

{
  "ollama": {
    "type": "api",
    "key": "***"
  }
}

important to note, I didn't have:

        "headers": {
          "Authorization": "Bearer ***"
        }

before, and I was seeing Unauthorized errors in opencode. using headers and hardcoding the token works.

@flacks commented on GitHub (Sep 11, 2025): @rekram1-node `opencode.jsonc` ``` { "$schema": "https://opencode.ai/config.json", "provider": { "ollama": { "npm": "ollama-ai-provider-v2", "name": "Ollama Turbo", "options": { "baseURL": "https://ollama.com/api", "headers": { "Authorization": "Bearer ***" } }, "models": { "gpt-oss:20b": { "name": "GPT-OSS 20B" }, "gpt-oss:120b": { "name": "GPT-OSS 120B" }, "deepseek-v3.1:671b": { "name": "DeepSeek-V3.1 671B" } } } }, "model": "gpt-oss:120b" } ``` `auth.json` ``` { "ollama": { "type": "api", "key": "***" } } ``` important to note, I didn't have: ``` "headers": { "Authorization": "Bearer ***" } ``` before, and I was seeing `Unauthorized` errors in opencode. using headers and hardcoding the token works.
Author
Owner

@rekram1-node commented on GitHub (Sep 11, 2025):

gotcha, I was mostly trying to make sure both were called ollama, the docs definitely insinuate that this should work I will take a look at it see why it isn't

@rekram1-node commented on GitHub (Sep 11, 2025): gotcha, I was mostly trying to make sure both were called `ollama`, the docs definitely insinuate that this should work I will take a look at it see why it isn't
Author
Owner

@flacks commented on GitHub (Sep 11, 2025):

yep, definitely checked that. yeah, looked up and down through the docs and code, and that's the understanding I had as well. I still don't know the interaction between the npm package used for the provider and how that affects configuration options...

@flacks commented on GitHub (Sep 11, 2025): yep, definitely checked that. yeah, looked up and down through the docs and code, and that's the understanding I had as well. I still don't know the interaction between the npm package used for the provider and how that affects configuration options...
Author
Owner

@lyleschemmerling commented on GitHub (Sep 14, 2025):

I am struggling to get this to work with any of the shared configs here

@lyleschemmerling commented on GitHub (Sep 14, 2025): I am struggling to get this to work with any of the shared configs here
Author
Owner

@flacks commented on GitHub (Sep 14, 2025):

post yours, lets see

@flacks commented on GitHub (Sep 14, 2025): post yours, lets see
Author
Owner

@lyleschemmerling commented on GitHub (Sep 14, 2025):

So this actually wound up working

"ollama": {
      "name": "Ollama (Turbo)",
      "npm": "ollama-ai-provider-v2",
      "options": {
        "name": "ollama-gpt-oss",
        "baseURL": "https://ollama.com/api/",
        "headers": {
          "Authorization": "Bearer myKey"
        }
      },
      "models": {
        "gpt-oss:120b": {
          "name": "gpt-oss:120b"
        }
      }
    }

Something else was going on with my opencode I think as the requests this morning were not even erroring... they just were doing nothing. But then I noticed it was happening with networked ollama, too... I wish I had proper repro steps, but wouldn't be appropriate for this thread anyway.

so tl;dr that does work. But without this thread I would have had no idea that this was the way to hook up Turbo

@lyleschemmerling commented on GitHub (Sep 14, 2025): So this actually wound up working ``` "ollama": { "name": "Ollama (Turbo)", "npm": "ollama-ai-provider-v2", "options": { "name": "ollama-gpt-oss", "baseURL": "https://ollama.com/api/", "headers": { "Authorization": "Bearer myKey" } }, "models": { "gpt-oss:120b": { "name": "gpt-oss:120b" } } } ``` Something else was going on with my opencode I think as the requests this morning were not even erroring... they just were doing nothing. But then I noticed it was happening with networked ollama, too... I wish I had proper repro steps, but wouldn't be appropriate for this thread anyway. so tl;dr that does work. But without this thread I would have had no idea that this was the way to hook up Turbo
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1638